Commit 3dd80df
authored
test(generator-themeLookup): create isolated helper tests (JhaSourav07#3433)
## Description
Adds a dedicated test file for the themeLookup helper function in
`lib/svg/generator.ts` to improve test isolation and maintainability.
### Changes Made
- Created `lib/svg/generator.themeLookup.test.ts`
- Added coverage for standard valid inputs
- Added edge case tests for:
- `null` values
- `undefined` values
- empty inputs
- out-of-bounds parameters
- Verified outputs match expected behavior and technical specifications
- Ensured test execution completes within normal test runtime
expectations
### Test Cases Added
1. Returns expected result for valid standard parameters
2. Handles `null` input safely
3. Handles `undefined` input safely
4. Handles empty input values correctly
5. Handles out-of-bounds parameters correctly
### Verification
- [x] All new tests pass
- [x] Existing test suite remains green
- [x] No production code changes
Fixes JhaSourav07#2369
## Pillar
- [ ] 🎨 Pillar 1 — New Theme Design
- [ ] 📐 Pillar 2 — Geometric SVG Improvement
- [ ] 🕐 Pillar 3 — Timezone Logic Optimization
- [x] 🛠️ Other (Bug fix, refactoring, docs)
## Visual Preview
<img width="1542" height="932" alt="image"
src="https://github.com/user-attachments/assets/1ccfe9ce-2adb-48b1-8522-eb6f2c2433fd"
/>
## Checklist before requesting a review:
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally
(`localhost:3000/api/streak?user=YOUR_USERNAME`).
- [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): ...`).
- [x] I have updated `README.md` if I added a new theme or URL
parameter.
- [x] 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: 34 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 | + | |
0 commit comments