Skip to content

Test/themes utilities - #2681

Closed
desireddymohithreddy0925 wants to merge 6 commits into
Priyanshu-byte-coder:mainfrom
desireddymohithreddy0925:test/themes-utilities
Closed

Test/themes utilities#2681
desireddymohithreddy0925 wants to merge 6 commits into
Priyanshu-byte-coder:mainfrom
desireddymohithreddy0925:test/themes-utilities

Conversation

@desireddymohithreddy0925

Copy link
Copy Markdown
Contributor

Fixes #2612

Summary of Changes

Added unit tests for the pure utility functions exported from src/lib/themes.ts using Vitest to ensure consistent theme handling and to prevent regressions as the theme system evolves.

Details:

  1. isThemeId Tests:

    • Validated against all known valid theme IDs (classic-dark, modern-light-blue, nordic-frost, cyberpunk-matrix).
    • Confirmed it returns false for invalid string inputs.
    • Tested handling of null and undefined to ensure it doesn't throw.
  2. getThemeDefinition Tests:

    • Verified that the correct ThemeDefinition object is returned for every known theme ID.
    • Ensured that unknown or empty theme IDs gracefully fall back to the default classic-dark theme definition.
  3. isDarkTheme Tests:

    • Checked that it correctly returns true for dark-mode themes.
    • Checked that it returns false for light-mode themes (modern-light-blue).
    • Verified that unknown themes fall back safely to the default mode (which is dark).
  4. nextThemeId Tests:

    • Confirmed that cycling cycles correctly through all theme options in sequential order.
    • Verified that unknown input is handled gracefully and falls back to starting the cycle over from index 0 to 1 (modern-light-blue).

Impact

  • Ensures theme utilities behave correctly across all four current theme options.
  • Guards against unexpected behaviors and regressions if theme options are added or modified in the future.
  • Serves as clear, documented examples (documentation-through-tests) for the expected behavior of theme utilities.

@github-actions github-actions Bot added type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts) type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) gssoc26 GSSoC 2026 contribution labels Jun 22, 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 — this PR is identical to your other submissions (#2680-#2692). All contain the same goal-category feature code despite different test titles. This is not a test PR, it's a feature addition, and submitting 13 copies is points farming.

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

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) 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