Skip to content

Commit b2aa2b3

Browse files
committed
no global
1 parent ae5260f commit b2aa2b3

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

examples/fastify/__integration-tests__/fastify.spec.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@ import request from 'supertest';
22
import { buildApp } from '../src/app.js';
33

44
describe('fastify example integration', () => {
5-
const [app] = buildApp(false);
6-
7-
beforeAll(async () => {
8-
await app.ready();
9-
});
10-
11-
afterAll(async () => {
12-
await app.close();
13-
});
14-
155
it('sends GraphiQL', async () => {
6+
const [app] = buildApp(false);
7+
await app.ready();
168
const response = await request(app.server).get('/graphql').set({
179
accept: 'text/html',
1810
});
@@ -22,6 +14,8 @@ describe('fastify example integration', () => {
2214
});
2315

2416
it('handles query operation via POST', async () => {
17+
const [app] = buildApp(false);
18+
await app.ready();
2519
const response = await request(app.server)
2620
.post('/graphql')
2721
.set({ 'content-type': 'application/json' })
@@ -44,6 +38,8 @@ describe('fastify example integration', () => {
4438
});
4539

4640
it("exposes fastify's request and reply objects", async () => {
41+
const [app] = buildApp(false);
42+
await app.ready();
4743
const response = await request(app.server)
4844
.post('/graphql')
4945
.set({ 'content-type': 'application/json' })
@@ -66,6 +62,8 @@ describe('fastify example integration', () => {
6662
});
6763

6864
it('handles query operation via GET', async () => {
65+
const [app] = buildApp(false);
66+
await app.ready();
6967
const response = await request(app.server)
7068
.get('/graphql')
7169
.query({
@@ -85,6 +83,8 @@ describe('fastify example integration', () => {
8583
});
8684

8785
it('handles mutation operation via POST', async () => {
86+
const [app] = buildApp(false);
87+
await app.ready();
8888
const response = await request(app.server)
8989
.post('/graphql')
9090
.set({ 'content-type': 'application/json' })
@@ -107,6 +107,8 @@ describe('fastify example integration', () => {
107107
});
108108

109109
it('rejects mutation operation via GET with an useful error message', async () => {
110+
const [app] = buildApp(false);
111+
await app.ready();
110112
const response = await request(app.server)
111113
.get('/graphql')
112114
.query({
@@ -127,6 +129,8 @@ describe('fastify example integration', () => {
127129
});
128130

129131
it('handles subscription operations via GET', async () => {
132+
const [app] = buildApp(false);
133+
await app.ready();
130134
const response = await request(app.server)
131135
.get('/graphql')
132136
.set({ accept: 'text/event-stream' })
@@ -177,6 +181,8 @@ data"
177181
`);
178182
});
179183
it('handles subscription operations via POST', async () => {
184+
const [app] = buildApp(false);
185+
await app.ready();
180186
const response = await request(app.server)
181187
.post('/graphql')
182188
.set({
@@ -230,6 +236,8 @@ data"
230236
`);
231237
});
232238
it('should handle file uploads', async () => {
239+
const [app] = buildApp(false);
240+
await app.ready();
233241
const response = await request(app.server)
234242
.post('/graphql')
235243
.field(
@@ -252,6 +260,8 @@ data"
252260
});
253261
});
254262
it('request cancelation', async () => {
263+
const [app] = buildApp(false);
264+
await app.ready();
255265
const slowFieldResolverInvoked = createDeferred();
256266
const slowFieldResolverCanceled = createDeferred();
257267
const address = await app.listen({

0 commit comments

Comments
 (0)