Commit 44aa647
authored
test(themes): add forest theme tests (JhaSourav07#2308) (JhaSourav07#3124)
## Description
Fixes JhaSourav07#2308
Created a dedicated unit test file `lib/svg/themes/forest.test.ts` to
verify the color variables and configuration of the `forest` theme, as
outlined in the issue.
### Implementation Steps Covered
- ✅ Imports the `themes` object from `lib/svg/themes.ts`
- ✅ Asserts the `forest` key exists
- ✅ Verifies `themes.forest.bg`, `themes.forest.text`, and
`themes.forest.accent` are valid 6-character hex strings (using regex)
- ✅ Generates a dummy SVG using `generateSVG` configured with the forest
theme and asserts the theme's hex colors appear in the output
- ✅ Ensures the contrast between `bg` and `text` meets WCAG AA
accessibility criteria (≥ 4.5:1)
### 6 Tests Added — All Passing ✅
1. ✅ **imports the themes object and asserts the forest key exists**
2. ✅ **verifies `themes.forest.bg` is a valid 6-character hex color**
3. ✅ **verifies `themes.forest.text` is a valid 6-character hex color**
4. ✅ **verifies `themes.forest.accent` is a valid 6-character hex
color**
5. ✅ **generates an SVG using the forest theme and asserts theme hex
colors appear in the output**
6. ✅ **ensures the contrast between forest bg and text is sufficient
(WCAG accessibility)**
**Test Summary:**
- Test Files: `1 passed (1)`
- Tests: `6 passed (6)`
- Command used: `npx vitest run lib/svg/themes/forest.test.ts`
## Pillar
- [x] 🎨 Pillar 1 — New Theme Design
- [ ] 📐 Pillar 2 — Geometric SVG Improvement
- [ ] 🕐 Pillar 3 — Timezone Logic Optimization
- [ ] 🛠️ Other (Bug fix, refactoring, docs)
## Visual Preview
_No visual changes — this PR adds test coverage only (no UI/SVG output
modifications)._
## Checklist before requesting a review:
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally (`npx vitest run
lib/svg/themes/forest.test.ts` — all 6 tests pass).
- [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors (CI will fail otherwise).
- [x] My commits follow the Conventional Commits format (e.g.,
`feat(themes): ...`, `fix(calculate): ...`).
- [ ] I have updated `README.md` if I added a new theme or URL
parameter.
- [ ] I have started the repo.
- [x] I have made sure that i have only one commit to merge in this PR.
- [x] The SVG output matches the CommitPulse "premium quality" aesthetic
standard (no raw elements, smooth animations, correct fonts).
- [ ] (Recommended) I joined the CommitPulse Discord community for
contributor discussions, mentorship, and faster PR support.1 file changed
Lines changed: 97 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
0 commit comments