Skip to content

Commit 98b1287

Browse files
committed
test: use pure fetch
1 parent 9bbc7df commit 98b1287

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

spec/requestContextMiddleware.spec.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const { ApolloClient, gql, InMemoryCache } = require('@apollo/client/core');
21
describe('requestContextMiddleware', () => {
32
const requestContextMiddleware = (req, res, next) => {
43
req.config.aCustomController = 'aCustomController';
@@ -29,25 +28,25 @@ describe('requestContextMiddleware', () => {
2928
mountGraphQL: true,
3029
graphQLPath: '/graphql',
3130
});
32-
const client = new ApolloClient({
33-
uri: 'http://localhost:8378/graphql',
34-
cache: new InMemoryCache(),
31+
32+
await fetch('http://localhost:8378/graphql', {
33+
method: 'POST',
3534
headers: {
35+
'Content-Type': 'application/json',
3636
'X-Parse-Application-Id': 'test',
3737
'X-Parse-Master-Key': 'test',
3838
},
39-
});
40-
41-
await client.mutate({
42-
mutation: gql`
43-
mutation {
44-
createUser(input: { fields: { username: "test", password: "test" } }) {
45-
user {
46-
objectId
39+
body: JSON.stringify({
40+
query: `
41+
mutation {
42+
createUser(input: { fields: { username: "test", password: "test" } }) {
43+
user {
44+
objectId
45+
}
4746
}
4847
}
49-
}
50-
`,
48+
`,
49+
}),
5150
});
5251
expect(called).toBeTruthy();
5352
});

0 commit comments

Comments
 (0)