8b4b9ef8da
Forcing "type" to be explicit, works best will rollup on the frontend to exclude depdendencies
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { makeGraphqlAPIRequest } from 'test/integration/graphql/utils/make-graphql-api-request.util';
|
|
import {
|
|
type DeleteOneObjectFactoryInput,
|
|
deleteOneObjectMetadataQueryFactory,
|
|
} from 'test/integration/metadata/suites/object-metadata/utils/delete-one-object-metadata-query-factory.util';
|
|
import { type PerformMetadataQueryParams } from 'test/integration/metadata/types/perform-metadata-query.type';
|
|
import { warnIfNoErrorButExpectedToFail } from 'test/integration/metadata/utils/warn-if-no-error-but-expected-to-fail.util';
|
|
|
|
export const deleteOneObjectMetadata = async ({
|
|
input,
|
|
gqlFields,
|
|
expectToFail = false,
|
|
}: PerformMetadataQueryParams<DeleteOneObjectFactoryInput>) => {
|
|
const graphqlOperation = deleteOneObjectMetadataQueryFactory({
|
|
input,
|
|
gqlFields,
|
|
});
|
|
|
|
const response = await makeGraphqlAPIRequest(graphqlOperation);
|
|
|
|
if (expectToFail) {
|
|
warnIfNoErrorButExpectedToFail({
|
|
response,
|
|
errorMessage: 'Object Metadata deletion should have failed but did not',
|
|
});
|
|
}
|
|
|
|
return { data: response.body.data, errors: response.body.errors };
|
|
};
|