test(dashboard): clear localStorage in useTodoLists beforeEach

useTodoLists uses the SWR cache for todo lists. When run in batch with
other tests that populate localStorage, the hook hydrates with stale
data and the selectedListId filter test sees empty items. Reset cache
between tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-19 19:03:10 -07:00
parent 7fed7bc483
commit 294f719ae3

View File

@@ -61,6 +61,8 @@ function makeItem(id: string, listId: string, text: string, completed = false, s
describe("useTodoLists", () => {
beforeEach(() => {
vi.clearAllMocks();
// Reset SWR cache so prior tests' todo lists don't pre-hydrate into state.
localStorage.clear();
mockUpdateTodoList.mockResolvedValue({} as TodoList);
mockDeleteTodoItem.mockResolvedValue();
});