mirror of
https://github.com/twentyhq/twenty.git
synced 2026-05-19 05:53:23 -04:00
Forcing "type" to be explicit, works best will rollup on the frontend to exclude depdendencies
22 lines
537 B
TypeScript
22 lines
537 B
TypeScript
import { type ASTNode, print } from 'graphql';
|
|
import request from 'supertest';
|
|
|
|
type GraphqlOperation = {
|
|
query: ASTNode;
|
|
variables?: Record<string, unknown>;
|
|
};
|
|
|
|
export const makeGraphqlAPIRequestWithApiKey = (
|
|
graphqlOperation: GraphqlOperation,
|
|
) => {
|
|
const client = request(`http://localhost:${APP_PORT}`);
|
|
|
|
return client
|
|
.post('/graphql')
|
|
.set('Authorization', `Bearer ${API_KEY_ACCESS_TOKEN}`)
|
|
.send({
|
|
query: print(graphqlOperation.query),
|
|
variables: graphqlOperation.variables || {},
|
|
});
|
|
};
|