break: remove gql

This commit is contained in:
Innei
2022-02-11 19:07:39 +08:00
parent 96ea8db0a9
commit 4c5653546c
26 changed files with 34 additions and 916 deletions

View File

@@ -1,52 +0,0 @@
import { GraphQLModule } from '@nestjs/graphql'
import { NestFastifyApplication } from '@nestjs/platform-fastify'
import { Test } from '@nestjs/testing'
import { join } from 'path'
import { AppResolver } from '~/app.resolver'
import { fastifyApp } from '~/common/adapters/fastify.adapter'
describe('GQL test (e2e)', () => {
let app: NestFastifyApplication
beforeAll(async () => {
const moduleRef = await Test.createTestingModule({
imports: [
GraphQLModule.forRoot({
autoSchemaFile: join(process.cwd(), 'schema.gql'),
context: ({ req }) => ({ req }),
}),
AppResolver,
],
}).compile()
app = moduleRef.createNestApplication<NestFastifyApplication>(fastifyApp)
await app.init()
await app.getHttpAdapter().getInstance().ready()
})
it('GET /graphql', () => {
return app
.inject({
method: 'post',
url: '/graphql',
payload: {
operationName: null,
variables: {},
query: ` {
sayHello
}`,
},
})
.then((res) => {
expect(res.statusCode).toBe(200)
expect(res.json()).toStrictEqual({
data: {
sayHello: 'Hello World!',
},
})
})
})
afterAll(async () => {
await app.close()
})
})