add integration test on global search resolver (#11007)
closes https://github.com/twentyhq/core-team-issues/issues/580
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
import { randomUUID } from 'crypto';
|
||||
|
||||
import { createManyOperationFactory } from 'test/integration/graphql/utils/create-many-operation-factory.util';
|
||||
import { makeGraphqlAPIRequest } from 'test/integration/graphql/utils/make-graphql-api-request.util';
|
||||
import { capitalize } from 'twenty-shared';
|
||||
|
||||
export const performCreateManyOperation = async (
|
||||
objectMetadataSingularName: string,
|
||||
objectMetadataPluralName: string,
|
||||
gqlFields: string,
|
||||
data: object[],
|
||||
) => {
|
||||
const response = await makeGraphqlAPIRequest(
|
||||
createManyOperationFactory({
|
||||
objectMetadataSingularName,
|
||||
objectMetadataPluralName,
|
||||
gqlFields,
|
||||
data: data.map((item) => ({
|
||||
id: randomUUID(),
|
||||
...item,
|
||||
})),
|
||||
}),
|
||||
);
|
||||
|
||||
return response.body.data[`create${capitalize(objectMetadataPluralName)}`];
|
||||
};
|
||||
Reference in New Issue
Block a user