Skip to content

[BE-110] End-to-end API tests against a real Postgres #1163

Description

@yusuftomilola

Overview

Unit tests mock repositories, so migrations, constraints, and cascade behaviour go unverified. With the schema being rebuilt from scratch, migration correctness matters more than usual.

Tasks

  • Add @testcontainers/postgresql and boot a throwaway Postgres per E2E run.
  • Run real migrations against it — this alone catches broken migrations.
  • Cover the critical journeys: register → login → create asset → assign → request transfer → approve → verify history.
  • Cover authorization: an EMPLOYEE cannot approve transfers or read another branch's assets.
  • Truncate tables between tests for isolation.
  • Add a CI job running E2E on pull requests.

Acceptance Criteria

  • npm run test:e2e passes locally with only Docker required.
  • A deliberately broken migration fails the job.
  • Authorization tests fail if a guard is removed.

Dependencies

Blocked by [BE-74], [BE-80], [BE-86], [BE-92].

Notes for Contributors

The backend is being rebuilt from a clean NestJS skeleton — backend/src/ currently contains only app.module.ts, app.controller.ts, app.service.ts, and main.ts. Follow standard NestJS module structure (module / controller / service / dto / entities) and register your module in app.module.ts. Comment below to be assigned.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackenddevopsCI/CD, infrastructure, and deploymenttestingTests, QA, and quality assurance

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions