refactor(04): move rank.test.ts into tests/ mirror dir (convention + dist hygiene)

src/lib/rank.test.ts was the last co-located API test. The API tsconfig excludes
tests/ from the build, so all test files belong there; a test in src/ gets compiled
into dist/ and vitest then runs the stale compiled copy (the source of phantom
'22 todo' and dist sourcemap warnings). Moving it to tests/lib/ matches convention
and leaves zero test files in src/, so the production build no longer emits test
artifacts. Updated rank.test.ts path refs in phase-04 plan docs.
This commit is contained in:
Lucas Berger
2026-06-09 13:40:11 -04:00
parent ca9e97879f
commit 690f0b95c0
5 changed files with 20 additions and 20 deletions
@@ -8,7 +8,7 @@ files_modified:
- 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
- apps/api/tests/lib/rank.test.ts
- apps/pwa/src/api/listsClient.ts
- apps/pwa/src/routes/ListDetail.tsx
- apps/pwa/src/routes/ListDetail.test.tsx
@@ -77,7 +77,7 @@ 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/tests/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/tests/lib/rank.test.ts</files>
<read_first>
- apps/api/src/routes/lists.ts (listsRouter from Plan 03 — extend; access-check pattern)
- apps/api/tests/routes/lists.test.ts (item stubs)
@@ -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 tests/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 tests/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 tests/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 tests/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>