Skip to main content
Version: 1.4.0

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 requests
  • test/e2e-env.ts — env required to boot without a .env file
  • test/jest-e2e.json — mapper and setup file
  • .gitlab-ci.yml — npm run test:e2e in the test job

Technical decisions​

  • Stub the database instead of running Mongo in CI.
  • Keep e2e in the same test job. 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