Skip to content

Add unit tests for ThemeEngine #106

Description

@alimaandev

Summary

desktop/src/core/ThemeEngine.ts implements the theme mode state (dark/light), persistence via localStorage (key \ riday-theme), and emits a \ heme:change\ event through EventBus. It currently has no test file.

Goal

Create desktop/src/test/ThemeEngine.test.ts covering:

  • Default mode is \dark\
  • \set()\ persists the choice to localStorage
  • \get()\ returns the stored mode after a reload
  • \set()\ emits a \ heme:change\ event via EventBus
  • Invalid stored values fall back to \dark\

Tasks

  • Write the Vitest test file (jsdom environment)
  • Mock localStorage and EventBus where needed
  • Follow the style of existing tests in desktop/src/test/

Acceptance criteria

  • All listed behaviors are covered

  • pm run test\ passes with the new file

Labels

good first issue, help wanted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions