|
1 | 1 | import { setTimeout } from 'timers/promises';
|
2 | 2 | import { parse } from 'graphql';
|
3 |
| -import { createSchema, createYoga, Repeater } from 'graphql-yoga'; |
| 3 | +import { createSchema, createYoga, DisposableSymbols, Repeater } from 'graphql-yoga'; |
4 | 4 | import { ApolloClient, FetchResult, InMemoryCache } from '@apollo/client/core';
|
5 | 5 | import { buildHTTPExecutor } from '@graphql-tools/executor-http';
|
6 | 6 | import { createDeferred } from '@graphql-tools/utils';
|
@@ -55,23 +55,21 @@ describe('Apollo Link', () => {
|
55 | 55 | }),
|
56 | 56 | });
|
57 | 57 |
|
| 58 | + const executor = buildHTTPExecutor({ |
| 59 | + endpoint: `http://localhost${yoga.graphqlEndpoint}`, |
| 60 | + fetch: yoga.fetch, |
| 61 | + File: yoga.fetchAPI.File, |
| 62 | + FormData: yoga.fetchAPI.FormData, |
| 63 | + }); |
58 | 64 | const client = new ApolloClient({
|
59 |
| - link: new ExecutorLink( |
60 |
| - buildHTTPExecutor({ |
61 |
| - endpoint: `http://localhost${yoga.graphqlEndpoint}`, |
62 |
| - fetch: yoga.fetch, |
63 |
| - File: yoga.fetchAPI.File, |
64 |
| - FormData: yoga.fetchAPI.FormData, |
65 |
| - }), |
66 |
| - ), |
| 65 | + link: new ExecutorLink(executor), |
67 | 66 | cache: new InMemoryCache(),
|
68 | 67 | });
|
69 | 68 |
|
70 |
| - beforeEach(() => {}); |
71 |
| - |
72 |
| - afterAll(() => { |
| 69 | + afterAll(async () => { |
| 70 | + await executor[DisposableSymbols.asyncDispose](); |
73 | 71 | client.stop();
|
74 |
| - return client.clearStore(); |
| 72 | + await client.clearStore(); |
75 | 73 | });
|
76 | 74 |
|
77 | 75 | it('should handle queries correctly', async () => {
|
|
0 commit comments