Add unit tests for color and utils libraries#30
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
lindetoolbox | e532720 | Jun 11 2026, 01:54 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
color.tsandutils.tshad no test coverage despite being used by multiple tools (WCAG contrast checker, tints/shades, color palette, font converter). This adds 59 tests covering all exported pure functions.dlis intentionally excluded — it requires DOM APIs and is untestable in the Node Vitest environment.Test plan
npm test→ all 102 tests greenfmtBytes— byte/KB/MB boundary values produce correct formatted stringsbaseName/extOf— multi-part names, hidden files, no-extension inputshexToRgb/rgbToHex— 3-digit shorthand expansion, round-trip fidelityrgbToHsl/hslToRgb— primary colors, black, white, grey, round-trip within rounding tolerancerelativeLuminance— black=0, white=1, output in [0,1]contrastRatio— black/white ≈21:1, symmetry, WCAG AA threshold (≥4.5)isLight— white/yellow light; black/navy darkisValidHex— accepts #rgb and #rrggbb; rejects missing hash, wrong length, invalid charsmixColors— t=0 returns first color, t=1 returns second, t=0.5 midpoint, known interpolation value