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
@@ -6,7 +6,7 @@ wave: 2
depends_on: ["04-01"]
files_modified:
- apps/api/src/routes/lists.ts
- apps/api/src/routes/lists.test.ts
- apps/api/tests/routes/lists.test.ts
- apps/api/src/index.ts
- apps/pwa/src/api/listsClient.ts
- apps/pwa/src/routes/ListsIndex.tsx
@@ -80,10 +80,10 @@ Output: listsRouter mounted at /api/lists; ListsIndex wired to real data; Create
<task type="auto" tdd="true">
<name>Task 1: Lists router — POST/GET/PATCH/DELETE /api/lists with scoped access (LIST-01, D-01/D-02/D-04/D-06)</name>
<files>apps/api/src/routes/lists.ts, apps/api/src/routes/lists.test.ts, apps/api/src/index.ts</files>
<files>apps/api/src/routes/lists.ts, apps/api/tests/routes/lists.test.ts, apps/api/src/index.ts</files>
<read_first>
- apps/api/src/routes/events.ts (full — resolveUserId, zod schemas, handler/try-catch/401 conventions)
- apps/api/src/routes/lists.test.ts (RED stub from Plan 01)
- apps/api/tests/routes/lists.test.ts (RED stub from Plan 01)
- apps/api/src/index.ts (route mount order)
- apps/api/src/auth/user.ts (upsertUser, deriveDisplayName signatures)
- apps/api/src/db/schema.ts (lists, listShares, listItems, users)
@@ -107,7 +107,7 @@ Output: listsRouter mounted at /api/lists; ListsIndex wired to real data; Create
Mount in index.ts: `import { listsRouter }` and `app.route('/api/lists', listsRouter)` after the sseRouter mount (so it sits behind the OIDC/dev-bypass guard). Do NOT add fan-out emit calls here yet — Plan 06 adds publishListEvent triggers once the SSE endpoint exists (leave a commented seam, note it in SUMMARY). NOTE: per-field item PATCH and item endpoints are Plan 04; this plan is lists only.
</action>
<verify>
<automated>pnpm --filter @familysync/api exec vitest run src/routes/lists.test.ts && grep -q "app.route('/api/lists'" apps/api/src/index.ts && pnpm --filter @familysync/api typecheck</automated>
<automated>pnpm --filter @familysync/api exec vitest run tests/routes/lists.test.ts && grep -q "app.route('/api/lists'" apps/api/src/index.ts && pnpm --filter @familysync/api typecheck</automated>
</verify>
<acceptance_criteria>
- lists.test.ts: all create/get/delete/patch/scope tests green, including the D-04 "private list of another member is NOT returned by GET /api/lists" assertion.
@@ -176,7 +176,7 @@ Output: listsRouter mounted at /api/lists; ListsIndex wired to real data; Create
</threat_model>
<verification>
<automated>pnpm --filter @familysync/api exec vitest run src/routes/lists.test.ts && pnpm --filter @familysync/pwa exec tsc --noEmit</automated>
<automated>pnpm --filter @familysync/api exec vitest run tests/routes/lists.test.ts && pnpm --filter @familysync/pwa exec tsc --noEmit</automated>
- `playwright-cli`: create + delete a list end to end.
- D-04 negative test green.
</verification>