Files
nest/integration/graphql-schema-first/e2e/graphql-async.spec.ts
2020-02-29 13:21:21 +01:00

37 lines
860 B
TypeScript

import { INestApplication } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import * as request from 'supertest';
import { AsyncApplicationModule } from '../src/async-options.module';
describe('GraphQL (async configuration)', () => {
let app: INestApplication;
beforeEach(async () => {
app = await NestFactory.create(AsyncApplicationModule, { logger: false });
await app.init();
});
it(`should return query result`, () => {
return request(app.getHttpServer())
.post('/graphql')
.send({
operationName: null,
variables: {},
query: '{\n getCats {\n id\n }\n}\n',
})
.expect(200, {
data: {
getCats: [
{
id: 1,
},
],
},
});
});
afterEach(async () => {
await app.close();
});
});