Skip to content

test : added unit tests for themes.ts#2761

Closed
tmdeveloper007 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
tmdeveloper007:#2758
Closed

test : added unit tests for themes.ts#2761
tmdeveloper007 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
tmdeveloper007:#2758

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #2758.

Summary of What Has Been Done: Added a vitest test file test/themes.test.ts covering all exported pure functions from src/lib/themes.ts.

Changes Made:

  • Created test/themes.test.ts with 23 tests across 4 describe blocks.
  • isThemeId: tested all 4 valid theme IDs (true) and invalid inputs (false) including empty string, null, undefined, and partial matches.
  • getThemeDefinition: tested each valid theme ID returns correct ThemeDefinition with id, name, mode. Tested invalid ID falls back to classic-dark.
  • isDarkTheme: tested classic-dark, nordic-frost, cyberpunk-matrix return true; modern-light-blue returns false.
  • nextThemeId: tested correct cycle order, wrap-around from cyberpunk-matrix to classic-dark, and invalid ID fallback.

Impact it Made: Theme selection is user-facing in settings and on the public profile. These functions are the single source of truth for theme metadata; testing ensures theme IDs are validated correctly and the cycle navigation works without regression.

Hello @Priyanshu-byte-coder, please assign this issue to me (@tmdeveloper007) so I can open a focused PR.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:design GSSoC type bonus: UI/design (+10 pts) type:testing GSSoC type bonus: tests (+10 pts) and removed gssoc26 GSSoC 2026 contribution type:design GSSoC type bonus: UI/design (+10 pts) labels Jun 23, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Umbrella-io — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

Closing as duplicate. #2774 was selected as the themes test winner — it uses loops over THEME_OPTIONS making tests maintainable if themes are added, rather than hardcoding every theme ID. Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for themes.ts

2 participants