refactor(04-01): move API list test stubs into tests/ mirror dir to match convention

The two Wave-0 RED stubs (lists.test.ts, listEmitter.test.ts) were co-located in
src/ but all existing API tests live in apps/api/tests/. Move them to tests/routes/
and tests/lib/, add explicit vitest imports to match the tests/ convention, and
update path references in downstream plans 04-02..04-06. PWA tests keep co-location
(that IS the PWA convention).
This commit is contained in:
Lucas Berger
2026-06-09 12:10:31 -04:00
parent 0fd4d66ee7
commit 60745b3281
11 changed files with 43 additions and 39 deletions
@@ -9,7 +9,7 @@ files_modified:
- apps/pwa/src/components/ItemRow.tsx
- apps/pwa/src/api/listsClient.ts
- apps/api/src/lib/rank.test.ts
- apps/api/src/routes/lists.test.ts
- apps/api/tests/routes/lists.test.ts
autonomous: true
requirements: [LIST-03]
user_setup: []
@@ -97,10 +97,10 @@ Output: dnd-kit DndContext/SortableContext in ListDetail; sortable ItemRow with
<task type="auto">
<name>Task 2: Strengthen server-side reorder ordering tests (LIST-03, D-13)</name>
<files>apps/api/src/lib/rank.test.ts, apps/api/src/routes/lists.test.ts</files>
<files>apps/api/src/lib/rank.test.ts, apps/api/tests/routes/lists.test.ts</files>
<read_first>
- apps/api/src/lib/rank.test.ts (from Plan 04)
- apps/api/src/routes/lists.test.ts (PATCH position coverage)
- apps/api/tests/routes/lists.test.ts (PATCH position coverage)
- .planning/phases/04-shared-lists-live-sync/04-VALIDATION.md (LIST-03 row: "PATCH new rank produces correct fractional order")
- .planning/phases/04-shared-lists-live-sync/04-RESEARCH.md §"Common Pitfalls" Pitfall 2 (precision)
</read_first>
@@ -108,7 +108,7 @@ Output: dnd-kit DndContext/SortableContext in ListDetail; sortable ItemRow with
Add server-side tests proving reorder correctness: (a) repeated mid-point inserts via rankBetween produce strictly increasing distinct strings over many iterations (precision does not collapse — Pitfall 2); (b) PATCH /api/list-items/:id { position } updates only rank and a subsequent GET returns items in the new ASC order; (c) moving an item between two neighbors yields a rank strictly between theirs. These align the LIST-03 row in 04-VALIDATION.md to a green automated check. No production behavior change — Plan 04 already implements the PATCH position path.
</action>
<verify>
<automated>pnpm --filter @familysync/api exec vitest run src/lib/rank.test.ts src/routes/lists.test.ts</automated>
<automated>pnpm --filter @familysync/api exec vitest run src/lib/rank.test.ts tests/routes/lists.test.ts</automated>
</verify>
<acceptance_criteria>
- LIST-03 ordering test ("PATCH new rank produces correct fractional order") is present and green.
@@ -136,7 +136,7 @@ Output: dnd-kit DndContext/SortableContext in ListDetail; sortable ItemRow with
</threat_model>
<verification>
<automated>pnpm --filter @familysync/api exec vitest run src/lib/rank.test.ts src/routes/lists.test.ts && pnpm --filter @familysync/pwa exec tsc --noEmit</automated>
<automated>pnpm --filter @familysync/api exec vitest run src/lib/rank.test.ts tests/routes/lists.test.ts && pnpm --filter @familysync/pwa exec tsc --noEmit</automated>
- `playwright-cli`: drag-reorder persists across reload.
</verification>