Skip to content

Commit

Permalink
Add apollo-server-integration-testing dependency
Browse files Browse the repository at this point in the history
You can't really write real integration tests with apollo-server-testing, because it doesn't support servers which rely on the context option being a function that uses the req object despite this functionality being supported by the real apollo server.

The official integration example code from Apollo solves this by instantiating an ApolloServer inside the test and mocking the context value by hand. But I don't consider this a real integration test, since you're not using the same instantiation code that your production code uses.

* description of issue with apollo-server-testing: apollographql/apollo-server#2277
* workaround: https://github.com/apollographql/fullstack-tutorial/blob/6988f6948668ccc2dea3f7a216dd44bdf25a0b9f/final/server/src/__tests__/integration.js#L68-L74
  • Loading branch information
deduced committed May 8, 2021
1 parent 5dabd2e commit d16ffed
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 6 deletions.
77 changes: 71 additions & 6 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/package.json
Expand Up @@ -35,6 +35,7 @@
"@types/node": "^14.14.8",
"@types/nodemailer": "^6.4.1",
"@types/uuid": "^8.3.0",
"apollo-server-integration-testing": "^3.0.0",
"apollo-server-testing": "^2.19.0",
"faker": "^5.1.0",
"gen-env-types": "^1.0.4",
Expand Down

0 comments on commit d16ffed

Please sign in to comment.