Commit 6569a3d
committed
test: milestone repository soft-delete and verifier-assignment tests
Adds query-correctness tests for soft-delete filtering and verifier-user
assignment on the milestone repository. Issue #734.
Changes:
- src/repositories/milestoneRepository.ts
Adds findById(id, opts?) and listForVerifier(userId, opts?) to
MilestoneRepository. Both exclude soft-deleted rows by default and
honour the verifier_user_id linkage added by
db/migrations/20260428140504_add_verifier_user_id_to_milestones.cjs
and the deleted_at column added by
db/migrations/20260602125638_add_soft_delete_to_vaults_and_milestones.cjs.
Adds softDelete(id, deletedAt?) and restore(id) for the round-trip
case. The existing embedding methods are unchanged.
- src/repositories/milestoneRepository.test.ts (new)
18 tests against the project test DB harness, organised into two
suites:
* soft-delete filtering — findById returns null for soft-deleted
rows by default and with includeDeleted when requested; softDelete
is idempotent; restore is a no-op on already-active or unknown
rows; deleted-then-restored round-trip preserves the
verifier_user_id linkage.
* verifier-assignment queries — listForVerifier returns only rows
assigned to the verifier, never unassigned or other verifiers,
and never soft-deleted rows by default; a dedicated round-trip
test exercises softDelete \u2192 listForVerifier excludes \u2192 restore
\u2192 listForVerifier includes for the same verifier.
Skips cleanly when DATABASE_URL is unset.
- jest.config.cjs
Adds **/src/repositories/**/*.test.ts to testMatch so the new test
file is picked up by jest without forcing the project-wide test
pattern to change.
Coverage: every new/changed line is exercised by at least one test.
No regressions to existing MilestoneRepository behaviour.1 parent 027d351 commit 6569a3d
3 files changed
Lines changed: 597 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
0 commit comments