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:
@@ -6,7 +6,7 @@ wave: 3
|
||||
depends_on: ["04-03"]
|
||||
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/lib/rank.ts
|
||||
- apps/api/src/lib/rank.test.ts
|
||||
- apps/pwa/src/api/listsClient.ts
|
||||
@@ -77,10 +77,10 @@ Output: item endpoints on listsRouter (POST items, per-field PATCH, DELETE); ran
|
||||
|
||||
<task type="auto" tdd="true">
|
||||
<name>Task 1: Item endpoints + fractional-rank assignment (LIST-02, D-05/D-08/D-09)</name>
|
||||
<files>apps/api/src/routes/lists.ts, apps/api/src/routes/lists.test.ts, apps/api/src/lib/rank.ts, apps/api/src/lib/rank.test.ts</files>
|
||||
<files>apps/api/src/routes/lists.ts, apps/api/tests/routes/lists.test.ts, apps/api/src/lib/rank.ts, apps/api/src/lib/rank.test.ts</files>
|
||||
<read_first>
|
||||
- apps/api/src/routes/lists.ts (listsRouter from Plan 03 — extend; access-check pattern)
|
||||
- apps/api/src/routes/lists.test.ts (item stubs)
|
||||
- apps/api/tests/routes/lists.test.ts (item stubs)
|
||||
- apps/api/src/db/schema.ts (listItems)
|
||||
- .planning/phases/04-shared-lists-live-sync/04-RESEARCH.md Finding 2 (fractional-indexing API), Finding 6 (per-field PATCH zod), §"Open Questions" item 2 (uncheck rank)
|
||||
- .planning/phases/04-shared-lists-live-sync/04-PATTERNS.md §"apps/api/src/routes/lists.ts" (zod patchItemSchema, ownership verification)
|
||||
@@ -105,7 +105,7 @@ Output: item endpoints on listsRouter (POST items, per-field PATCH, DELETE); ran
|
||||
Note the route paths: items-by-list use /:id/items (nested under lists); single-item mutations use /list-items/:itemId at the listsRouter root (matches RESEARCH architecture diagram). Mount accordingly so both resolve under /api. Do NOT add publishListEvent here — Plan 06 inserts fan-out triggers (leave a clearly commented seam after each successful write).
|
||||
</action>
|
||||
<verify>
|
||||
<automated>pnpm --filter @familysync/api exec vitest run src/routes/lists.test.ts src/lib/rank.test.ts && pnpm --filter @familysync/api typecheck</automated>
|
||||
<automated>pnpm --filter @familysync/api exec vitest run tests/routes/lists.test.ts src/lib/rank.test.ts && pnpm --filter @familysync/api typecheck</automated>
|
||||
</verify>
|
||||
<acceptance_criteria>
|
||||
- rank.ts tests green; ordering stable.
|
||||
@@ -172,7 +172,7 @@ Output: item endpoints on listsRouter (POST items, per-field PATCH, DELETE); ran
|
||||
</threat_model>
|
||||
|
||||
<verification>
|
||||
<automated>pnpm --filter @familysync/api exec vitest run src/routes/lists.test.ts src/lib/rank.test.ts && pnpm --filter @familysync/pwa exec vitest run src/routes/ListDetail.test.tsx</automated>
|
||||
<automated>pnpm --filter @familysync/api exec vitest run tests/routes/lists.test.ts src/lib/rank.test.ts && pnpm --filter @familysync/pwa exec vitest run src/routes/ListDetail.test.tsx</automated>
|
||||
- `playwright-cli`: add / check / delete items in a real browser.
|
||||
</verification>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user