p2-ai-first-testing-harness

drafttype/backlogdomain/anabatictech/nestjstech/testing

p2 — AI-first testing harness (backend-pms-dev)

TL;DR

Implement the deferred AI-managed Jest testing plan: harness, scaffold scripts, Nest Swagger export, route coverage gate, and reference specs. Parked until API requirements stabilize and token budget is acceptable.

Description

Full strategy: [[Projects/anabatic-project-manager/context/testing-strategy-ai-first|Testing strategy — AI-first]].

Repo: Project Manager/backend-pms-dev/

Not in scope for this item: Cucumber, QA Gherkin workflow, CI gate on vault openapi.yaml.

Reason deferred

  • High agent token cost for full harness + multi-module specs.
  • OpenAPI / project aggregate / masters still changing — tests would churn.

Acceptance criteria

  • Jest path aliases fixed; stale e2e removed or replaced.
  • test/support/create-test-app, mock auth, mock repositories.
  • Scripts: openapi:export, test:unit, test:http, test:ai, test:scaffold, test:routes.
  • docs/testing/AI-TESTING.md + .cursor/rules/testing.mdc (or equivalent) for agent DoD.
  • Reference module: customers (or projects) with *.util.spec.ts + *.http.spec.ts.
  • test/manifest/routes.json + coverage script passes on main routes.
  • Open decisions in strategy doc resolved (Testcontainers vs mocks, export method, reference module).

Priority

p2 — after OpenAPI-critical API work and smoke-tested projects/customers flows.

Dependencies

  • Stable enough controllers/DTOs on priority modules (customers, projects).
  • Swagger decorators on public routes (@ApiProperty examples for AI fixtures).

Links

  • [[Projects/anabatic-project-manager/context/testing-strategy-ai-first]]
  • [[Projects/anabatic-project-manager/changelog/2026-05-22-pms-progress-snapshot]]