apollo-server で GraphQL バックエンド開発をしている際の、統合テスト(Integration Testing)を行うための手法として、apollo-server-testing と sqlite を用いるサンプルです。
こちらの記事で、詳細に解説していますので、あわせてご覧ください;
https://zenn.dev/suzukalight/articles/apollo-server-testing-sqlite
test/integration ディレクトリに統合テストを書いています。
実践用に、signInEmailPassword mutation のテストを test.skip で置いています。こちらの実装をハンズオンできます。
- Clean Architecture
- Node.js + TypeScript
- Apollo Server w/Express + apollo-server-testing
- TypeORM w/SQLite
- GraphQL Code Generator
- Jest w/ts-jest
yarn
yarn setup:env
yarn fix
yarn test
typecheck, lint, prettier, jest を実行できます。
yarn dev
yarn db:seed
http:https://localhost:3000/graphql にて mutation の実行が可能です。
ほかの query/mutation 実装については、このサンプルの元になっている以下のリポジトリをご覧ください;
https://github.com/suzukalight/clean-architecture-nodejs-graphql-codegen