@@ -5,8 +5,8 @@ import httpMocks from 'node-mocks-http';
5
5
import { print } from 'graphql' ;
6
6
import { convertNodeHttpToRequest , runHttpQuery } from 'apollo-server-core' ;
7
7
8
- import { type ApolloServer } from 'apollo-server-express' ;
9
- import { type DocumentNode } from 'graphql' ;
8
+ import { ApolloServer } from 'apollo-server-express' ;
9
+ import { DocumentNode } from 'graphql' ;
10
10
11
11
const mockRequest = ( options = { } ) =>
12
12
httpMocks . createRequest ( {
@@ -21,13 +21,13 @@ type StringOrAst = string | DocumentNode;
21
21
type TestClientConfig = {
22
22
// The ApolloServer instance that will be used for handling the queries you run in your tests.
23
23
// Must be an instance of the ApolloServer class from `apollo-server-express` (or a compatible subclass).
24
- apolloServer : ApolloServer ,
24
+ apolloServer : ApolloServer ;
25
25
// Extends the mocked Request object with additional keys.
26
26
// Useful when your apolloServer `context` option is a callback that operates on the passed in `req` key,
27
27
// and you want to inject data into that `req` object.
28
28
// If you don't pass anything here, we provide a default request mock object for you.
29
29
// See https://github.com/howardabrams/node-mocks-http#createrequest for all the default values that are included.
30
- extendMockRequest ?: { }
30
+ extendMockRequest ?: { } ;
31
31
} ;
32
32
33
33
// This function takes in an apollo server instance and returns a function that you can use to run operations
@@ -64,7 +64,10 @@ const createTestClient = ({
64
64
const req = mockRequest ( extendMockRequest ) ;
65
65
const res = mockResponse ( ) ;
66
66
67
- const graphQLOptions = apolloServer . createGraphQLServerOptions ( req , res ) ;
67
+ const graphQLOptions = await apolloServer . createGraphQLServerOptions (
68
+ req ,
69
+ res
70
+ ) ;
68
71
69
72
const { graphqlResponse } = await runHttpQuery ( [ req , res ] , {
70
73
method : 'POST' ,
0 commit comments