59d90bedaa
# Introduction Migrating and improving performances of field enum integrations tests success and failing tests cases to be using the new v2 api ## Discovered issue When deleting an object in v1 it will leave related enums until the object is re-created Something not done anymore within the create in v2 but in the delete operation We should implem an upgrade command to remove such relicas ## Bugs - Update/create default value multi select runner wrong sql query -> FIX - Update default value multi select regression, we should allow option without an id to be inserted -> FIX - default value compare dynamic json stringify convertion or not in compare tools for object and fields
49 lines
1.8 KiB
TypeScript
49 lines
1.8 KiB
TypeScript
import {
|
|
type FindManyObjectMetadataFactoryInput,
|
|
findManyObjectMetadataQueryFactory,
|
|
} from 'test/integration/metadata/suites/object-metadata/utils/find-many-object-metadata-query-factory.util';
|
|
import { makeMetadataAPIRequest } from 'test/integration/metadata/suites/utils/make-metadata-api-request.util';
|
|
import { type PerformMetadataQueryParams } from 'test/integration/metadata/types/perform-metadata-query.type';
|
|
import { warnIfErrorButNotExpectedToFail } from 'test/integration/metadata/utils/warn-if-error-but-not-expected-to-fail.util';
|
|
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
|
|
|
|
import { type BaseGraphQLError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
|
|
import { type ObjectMetadataDTO } from 'src/engine/metadata-modules/object-metadata/dtos/object-metadata.dto';
|
|
|
|
export const findManyObjectMetadata = async ({
|
|
input,
|
|
gqlFields,
|
|
expectToFail,
|
|
}: PerformMetadataQueryParams<FindManyObjectMetadataFactoryInput>): Promise<{
|
|
errors: BaseGraphQLError[];
|
|
objects: ObjectMetadataDTO[];
|
|
}> => {
|
|
const graphqlOperation = findManyObjectMetadataQueryFactory({
|
|
input,
|
|
gqlFields,
|
|
});
|
|
|
|
const response = await makeMetadataAPIRequest(graphqlOperation);
|
|
|
|
if (expectToFail === true) {
|
|
warnIfNoErrorButExpectedToFail({
|
|
response,
|
|
errorMessage: 'Object Metadata retrieval should have failed but did not',
|
|
});
|
|
}
|
|
|
|
if (expectToFail === false) {
|
|
warnIfErrorButNotExpectedToFail({
|
|
response,
|
|
errorMessage: 'Object Metadata retrieval has failed but should not',
|
|
});
|
|
}
|
|
|
|
return {
|
|
errors: response.body.errors,
|
|
objects: response.body.data.objects?.edges.map(
|
|
({ node }: { node: unknown }) => node,
|
|
),
|
|
};
|
|
};
|