What
Create a working test/jest-e2e.json configuration and write end-to-end tests for the core API flows: authentication (JWT + wallet signature), credential CRUD, verification workflow, and data sharing. Tests should use a real PostgreSQL database and Redis instance (via test containers or a test database).
Why
The backend has 22 unit test spec files but zero e2e tests. package.json references npm run test:e2e but the jest-e2e.json config file doesn't exist. Unit tests mock dependencies, so they can't catch integration issues like incorrect TypeORM queries, broken middleware chains, or auth flow failures. For a health credential platform, integration testing is critical.
Scope
In scope:
- Create
backend/test/jest-e2e.json with proper NestJS e2e test configuration
- Create a test database setup/teardown utility (TypeORM migrations or
synchronize: true for test DB)
- Write e2e tests for: auth flow (register + login via wallet signature), credential CRUD (create, read, update, delete), verification workflow (submit, approve, reject), data sharing (share, access, revoke)
- Add
test:e2e script that runs against a test database
- Add test fixtures for common test data
Out of scope:
- Load testing or performance testing
- Contract interaction testing (mock Soroban calls)
- IPFS integration testing (mock Pinata calls)
- AI/Groq integration testing (mock Groq calls)
Acceptance Criteria
Technical Context
- NestJS e2e testing: https://docs.nestjs.com/fundamentals/testing
- Use
@nestjs/testing Test.createTestingModule() with supertest for HTTP assertions
- TypeORM test config: use a separate
test database with synchronize: true
- Redis: use a separate DB index (e.g., DB 15) for tests
- Existing unit tests:
backend/src/**/*.spec.ts (22 files) — follow their patterns
What
Create a working
test/jest-e2e.jsonconfiguration and write end-to-end tests for the core API flows: authentication (JWT + wallet signature), credential CRUD, verification workflow, and data sharing. Tests should use a real PostgreSQL database and Redis instance (via test containers or a test database).Why
The backend has 22 unit test spec files but zero e2e tests.
package.jsonreferencesnpm run test:e2ebut thejest-e2e.jsonconfig file doesn't exist. Unit tests mock dependencies, so they can't catch integration issues like incorrect TypeORM queries, broken middleware chains, or auth flow failures. For a health credential platform, integration testing is critical.Scope
In scope:
backend/test/jest-e2e.jsonwith proper NestJS e2e test configurationsynchronize: truefor test DB)test:e2escript that runs against a test databaseOut of scope:
Acceptance Criteria
backend/test/jest-e2e.jsonexists and is validnpm run test:e2eruns successfully (requires PostgreSQL + Redis)Technical Context
@nestjs/testingTest.createTestingModule()withsupertestfor HTTP assertionstestdatabase withsynchronize: truebackend/src/**/*.spec.ts(22 files) — follow their patterns