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
+44
View File
@@ -0,0 +1,44 @@
/**
* Wave-0 RED stubs for the lists API router.
*
* These stubs cover LIST-01 through LIST-04 behavior.
* Downstream plans (02/03/06) replace the `it.todo` entries with real assertions
* once the routes and DB are wired.
*
* Security focus: T-04-02 — scoped fan-out (private list events must NOT reach non-owner).
*
* Run: pnpm --filter @familysync/api test
*/
import { describe, it } from 'vitest'
describe('GET /api/lists — LIST-01: returns only accessible lists', () => {
it.todo('returns empty array when user has no lists')
it.todo('returns lists owned by the current user')
it.todo('returns lists shared with the current user via list_shares')
it.todo('does NOT return private lists owned by another user')
})
describe('POST /api/lists — LIST-01: create list', () => {
it.todo('creates a list and inserts a list_shares row when isShared=true (D-01)')
it.todo('creates a private list with no list_shares row when isShared=false')
it.todo('rejects a name longer than 255 characters with 422')
it.todo('returns 401 when called without a session')
})
describe('PATCH /api/list-items/:id — LIST-02: per-field update', () => {
it.todo('updates only the checked field when patch body is { checked: true } (D-08)')
it.todo('updates only the text field when patch body is { text: "..." } (D-08)')
it.todo('rejects a patch body with more than one field with 422')
it.todo('returns 403 when caller does not own or share the parent list (T-04-02)')
})
describe('PATCH /api/list-items/:id rank — LIST-03: fractional reorder', () => {
it.todo('updates the rank field to the new fractional-indexing string')
it.todo('rejects an empty rank string with 422')
})
describe('SSE scoped fan-out — LIST-04 / T-04-02: private-list event isolation', () => {
it.todo('publishListEvent on a private list does NOT emit to a subscriber for a different list')
it.todo('publishListEvent on a shared list emits to all subscribers for that list')
})