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:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user