test(frontend): give the test environment working storage
This Vitest version's jsdom environment installed localStorage as a bare object with no methods, so the auth store's persist middleware threw and took 69 tests across 6 files down with it. A suite that red hides real regressions. Install an in-memory Storage for localStorage and sessionStorage, cleared between tests. That surfaced two failures it had been masking: PlaylistCard asserted a stale string id in its href, and the MSW mocks lacked a handler for POST /api/games, which is how search has worked since filter combinations outgrew the URL length limit. Frontend suite: 115/115.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
Defects found during deployment testing. Each entry records the symptom, the
|
||||
verified root cause, and either the agreed approach or the fix that landed.
|
||||
Item 6 remains open; item 3 is fixed for the heavy read paths.
|
||||
Item 3 is fixed for the heavy read paths; every other item is fixed.
|
||||
|
||||
---
|
||||
|
||||
@@ -148,4 +148,9 @@ predates current work.
|
||||
**Why it matters:** with that many failures as the normal state, a real
|
||||
regression in those files would go unnoticed.
|
||||
|
||||
**Approach:** provide a `localStorage` implementation in the frontend test setup.
|
||||
**Status: fixed.** The setup now installs a real in-memory `Storage` for
|
||||
`localStorage` and `sessionStorage`, cleared between tests. That surfaced two
|
||||
genuine failures the crash had been hiding, both fixed: `PlaylistCard` asserted a
|
||||
stale `/playlists/playlist-1` href when `Playlist.id` is a number, and the MSW
|
||||
mocks had no handler for `POST /api/games` (search became a POST when filter
|
||||
combinations outgrew the URL length limit). The frontend suite is now 115/115.
|
||||
|
||||
Reference in New Issue
Block a user