End-to-end tests
Overview
npm run test:e2e boots the Nest app and calls the public root routes. The GitLab test job runs it after the unit tests.
How it works
Jest resolves src/ imports. test/e2e-env.ts sets the config variables the app validates at boot, including a fake Magic secret. DATA_SOURCE is replaced with a stub whose createIndex resolves, so Mongo is not opened. The suite checks GET / and GET /health.
Key files
test/app.e2e-spec.ts— root and health requeststest/e2e-env.ts— env required to boot without a.envfiletest/jest-e2e.json— mapper and setup file.gitlab-ci.yml—npm run test:e2ein the test job
Technical decisions
- Stub the database instead of running Mongo in CI.
- Keep e2e in the same
testjob. The suite is two requests and does not need a service.
Known issues
- The suite does not exercise authenticated routes.
Next steps
- Cover one authenticated route when a fixture user exists without Mongo