You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constresponse=awaitquery(`{ currentUser { id } }`);
24
+
constresponse=awaitquery({
25
+
query:`{ currentUser { id } }`
26
+
});
25
27
26
28
expect(response.statusCode).toEqual(200);
27
29
@@ -44,7 +46,8 @@ const UPDATE_USER = `
44
46
}
45
47
`;
46
48
47
-
constmutationResponse=awaitmutate(UPDATE_USER, {
49
+
constmutationResponse=awaitmutate({
50
+
mutation:UPDATE_USER,
48
51
variables: { id:1, email:'nancy@foo.co' }
49
52
});
50
53
@@ -65,12 +68,12 @@ This allows you to test all the logic of your apollo server, including any logic
65
68
### Mocking the `Request` object
66
69
67
70
`createTestClient` automatically mocks the `Request` object that will be passed to the `context` option of your `ApolloServer` constructor, so testing works out of the box.
68
-
You can also extend the mocked Request object with additional keys by passing an `extendMockRequest` field to `createTestClient`:
71
+
You can also extend the mocked Request object with additional keys by passing a `requestOptions` parameter to `createTestClient`:
This is useful when your apollo server `context` option is a callback that operates on the passed in `req` key, and you want to inject data into that `req` object.
83
86
84
-
As mentioned above, if you don't pass an `extendMockRequest` to `createTestClient`, we provide a default request mock object for you.
87
+
As mentioned above, if you don't pass a `requestOptions` object to `createTestClient`, we provide a default request mock object for you.
0 commit comments