Skip to main content

Test configuration

Backend unit tests run on Jest with ts-jest, configured in backend/package.json:
Backend API E2E suites run through a separate Jest config: pnpm test:e2e uses test/jest-e2e.json with Supertest.

Unit tests

Unit tests verify individual functions in isolation, with no external dependencies.

Entitlement criteria tests

Entitlement phase tests

API E2E tests

Backend E2E suites exercise services and controllers against a real database through Supertest.

Access-control E2E tests (representative)

The access-control suite boots the real app with Supertest and asserts each role can only reach its permitted endpoints:

Test conventions

  • Each E2E suite mocks the better-auth session resolver and boots the real AppModule, so HTTP flows run against the database
  • Suites seed their own fixture data with a run-id suffix and clean up after themselves
  • Auth context arrives through mockRequest objects in service-level tests

Mocking patterns