Skip to content

test: stabilize ThemeToggle localStorage unit tests#20

Open
stokelykent-stack wants to merge 164 commits intogrp06:mainfrom
stokelykent-stack:nightly/2026-02-04-fix-theme-toggle-localstorage
Open

test: stabilize ThemeToggle localStorage unit tests#20
stokelykent-stack wants to merge 164 commits intogrp06:mainfrom
stokelykent-stack:nightly/2026-02-04-fix-theme-toggle-localstorage

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.

grp06 added 30 commits January 28, 2026 19:44
grp06 and others added 28 commits February 3, 2026 14:34
sioakim pushed a commit to sioakim/openclaw-studio that referenced this pull request Mar 2, 2026
- Wrap root page in Suspense boundary to fix useSearchParams() build error
- Fix React hooks memoization lint blockers (destructure stable params)
- Stabilize ThemeToggle localStorage unit tests with full Storage mock

Cherry-picked from upstream PRs grp06#88, grp06#86, grp06#20
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.

2 participants