Skip to content

test: cover ThemeContext system-preference change listener#608

Open
Truphile wants to merge 2 commits into
Disciplr-Org:mainfrom
Truphile:test/theme-context-system-listener
Open

test: cover ThemeContext system-preference change listener#608
Truphile wants to merge 2 commits into
Disciplr-Org:mainfrom
Truphile:test/theme-context-system-listener

Conversation

@Truphile

@Truphile Truphile commented Jun 30, 2026

Copy link
Copy Markdown

I have successfully completed the tasks to add tests for the OS-preference change listener in ThemeContext.tsx .

Here's a summary of the actions taken:

  1. Created a new branch test/theme-context-system-listener as requested.
  2. Fixed a pre-existing testing bug: The current test suite had jest.fn() accidentally used inside
    src/context/tests/ThemeContext.test.tsx , which was causing vitest to fail. I replaced these occurrences
    with vi.fn() .
  3. Implemented missing tests: The existing tests already covered most of the requirements (such as following OS
    changes, stopping the listener when manually switched, and resuming when system preference is reselected). I
    extended the test suite by adding an unmount test to verify that the removeEventListener is correctly called,
    ensuring no memory leaks or unexpected updates occur.
  4. Verified coverage and correctness: Ran the tests for ThemeContext.test.tsx using Vitest to ensure all tests
    pass cleanly.
  5. Committed changes: Pushed the commit with the message test: cover ThemeContext system-preference change
    listener per your instructions.

closes #328

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@Truphile Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Add tests for the ThemeContext system-preference change listener

1 participant