Skip to content

test : added unit tests for themes helper functions - #2617

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

test : added unit tests for themes helper functions#2617
tmdeveloper007 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
tmdeveloper007:#2612

Conversation

@tmdeveloper007

Copy link
Copy Markdown

Closes #2612.

Summary of What Has Been Done: Added unit tests for the pure utility functions exported from src/lib/themes.ts. The test file covers isThemeId, getThemeDefinition, isDarkTheme, nextThemeId, and the module constants.

Changes Made:

  • Created test/themes.test.ts with 16 test cases
  • isThemeId: tested all 4 valid IDs, null/undefined, and invalid strings
  • getThemeDefinition: tested each theme returns correct definition, fallback to classic-dark for unknown IDs
  • isDarkTheme: verified dark-mode themes return true, light-mode returns false
  • nextThemeId: tested forward cycling through all themes, wrap-around from last to first, graceful handling of unknown IDs
  • Added tests for THEME_OPTIONS length and DEFAULT_THEME constant

Impact it Made: Ensures theme utilities are correctly validated and documented. Guards against regressions when theme options are added or modified.

@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 20, 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

CI is failing on this PR. Please fix the TypeScript/test errors before we can merge. Run npm run typecheck and npm test locally to reproduce.

@tmdeveloper007

Copy link
Copy Markdown
Author

This PR has been closed as it has been stale for more than 2 days without recent activity or merging. If this work is still relevant, please reopen a fresh PR.

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 helper functions

2 participants