Skip to content

fix: add localStorage mock to vitest setup#109

Merged
DaviReisVieira merged 1 commit intomainfrom
fix/108-localstorage-mock-vitest
Apr 26, 2026
Merged

fix: add localStorage mock to vitest setup#109
DaviReisVieira merged 1 commit intomainfrom
fix/108-localstorage-mock-vitest

Conversation

@DaviReisVieira
Copy link
Copy Markdown
Owner

Closes #108

Summary

  • Adds an in-memory localStorage mock to ui/src/__tests__/setup.ts
  • Fixes 11 failing tests across useFavorites.test.ts (8) and Dashboard.test.tsx (3)
  • jsdom doesn't provide a functional localStorage — all calls to .getItem(), .setItem(), .clear() were throwing TypeError

Test plan

  • All 163 frontend tests pass (was 152/163)
  • TypeScript typecheck clean
  • No application code changes — test infrastructure only

jsdom doesn't provide a functional localStorage, causing 11 tests
to fail across useFavorites and Dashboard test suites.
@DaviReisVieira DaviReisVieira merged commit ac409f6 into main Apr 26, 2026
2 checks passed
@DaviReisVieira DaviReisVieira deleted the fix/108-localstorage-mock-vitest branch April 26, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: 11 frontend tests failing due to missing localStorage mock in vitest setup

1 participant