refactor: extract API route test harness #366

Closed
opened 2026-05-11 21:02:07 +00:00 by barrettruth · 0 comments
Owner

Parent: #355

Problem

API route tests repeat hoisted DB/user state, DB mocks, auth middleware mocks, encryption-key setup, and JSON helper boilerplate. This makes new route tests noisy and easy to wire incorrectly.

Solution

Create a small API route test harness:

  • centralize common DB/auth/encryption setup where Vitest hoisting allows it
  • centralize request/response JSON helpers
  • migrate a small representative set first, then expand if safe

Acceptance criteria

  • At least three existing API route test files use the harness.
  • Hoisting order remains reliable.
  • Full API test suite passes.
Parent: #355 ## Problem API route tests repeat hoisted DB/user state, DB mocks, auth middleware mocks, encryption-key setup, and JSON helper boilerplate. This makes new route tests noisy and easy to wire incorrectly. ## Solution Create a small API route test harness: - centralize common DB/auth/encryption setup where Vitest hoisting allows it - centralize request/response JSON helpers - migrate a small representative set first, then expand if safe ## Acceptance criteria - At least three existing API route test files use the harness. - Hoisting order remains reliable. - Full API test suite passes.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/delta#366
No description provided.