Skip to content

Conversation

@stokelykent-stack
Copy link

@stokelykent-stack stokelykent-stack commented Feb 4, 2026

Fix ThemeToggle unit tests that can fail in some JS DOM shims where window.localStorage is only partially implemented (missing clear() / removeItem()).

What changed

  • Define a small Storage-like localStorage mock in tests/unit/themeToggle.test.ts via Object.defineProperty(window, "localStorage", …)
  • Keeps the intent the same: persist theme on toggle + read stored theme on mount

Why

  • npm test was failing with TypeError: window.localStorage.clear is not a function.

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.

1 participant