- Adding a new target to the test setup suite - We add the MORPH_RELATION to the list of types we wanna test in the current test suites Important: I noticed the REST API was not working well with Morph relations. I created [an issue](https://github.com/twentyhq/core-team-issues/issues/2002) to work on that. Within that timeframe, I `xdescribed` the related tests Fixes https://github.com/twentyhq/core-team-issues/issues/1327
26 lines
801 B
TypeScript
26 lines
801 B
TypeScript
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/utils';
|
|
import { v4 } from 'uuid';
|
|
|
|
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: v4(),
|
|
...item,
|
|
})),
|
|
}),
|
|
);
|
|
|
|
return response.body.data[`create${capitalize(objectMetadataPluralName)}`];
|
|
};
|