Skip to content

Commit 4208187

Browse files
committed
test: each option's response is to be used
1 parent 102de6d commit 4208187

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/__tests__/handler.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import fetch from 'node-fetch';
22
import { startTServer } from './utils/tserver';
33

4-
it('should use the response returned from context', async () => {
5-
const server = startTServer({
6-
context: () => {
7-
return [null, { status: 418 }];
8-
},
9-
});
4+
it.each(['schema', 'context', 'onSubscribe', 'onOperation'])(
5+
'should use the response returned from %s',
6+
async (option) => {
7+
const server = startTServer({
8+
[option]: () => {
9+
return [null, { status: 418 }];
10+
},
11+
});
1012

11-
const url = new URL(server.url);
12-
url.searchParams.set('query', '{ __typename }');
13-
const res = await fetch(url.toString());
14-
expect(res.status).toBe(418);
15-
});
13+
const url = new URL(server.url);
14+
url.searchParams.set('query', '{ __typename }');
15+
const res = await fetch(url.toString());
16+
expect(res.status).toBe(418);
17+
},
18+
);

0 commit comments

Comments
 (0)