Files
twenty/packages/twenty-server/test/integration/metadata/suites/utils/make-metadata-api-request.util.ts
Marie 7bde2006c5 Add integration tests for /metadata + fix relation deletion (#8706)
In this PR

1. Add integration tests for /metadata (master issue:
https://github.com/twentyhq/twenty/issues/8719)
2. Fix relation deletion: index on "from" object was not deleted,
impeding creation of a new relation between the same two objects A and B
after relation between A and B was deleted
2024-11-26 10:00:36 +01:00

20 lines
511 B
TypeScript

import { ASTNode, print } from 'graphql';
import request from 'supertest';
type GraphqlOperation = {
query: ASTNode;
variables?: Record<string, unknown>;
};
export const makeMetadataAPIRequest = (graphqlOperation: GraphqlOperation) => {
const client = request(`http://localhost:${APP_PORT}`);
return client
.post('/metadata')
.set('Authorization', `Bearer ${ACCESS_TOKEN}`)
.send({
query: print(graphqlOperation.query),
variables: graphqlOperation.variables || {},
});
};