Skip to content

Commit 2db3005

Browse files
authored
test: add invalid bg hex validation coverage (JhaSourav07#3281)
## Description Adds validation coverage for invalid `bg` hex color input. Fixes JhaSourav07#3239 ## Pillar - [ ] 🎨 Pillar 1 β€” New Theme Design - [ ] πŸ“ Pillar 2 β€” Geometric SVG Improvement - [ ] πŸ•’ Pillar 3 β€” Timezone Logic Optimization - [x] πŸ›  Other (Bug fix, refactoring, docs) ## Visual Preview N/A β€” test-only change, no visual output changes. ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally (`npm run test -- app/api/streak/route.test.ts`). - [ ] 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 starred 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.
2 parents 5db3f49 + be31c47 commit 2db3005

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

β€Žapp/api/streak/route.test.tsβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,11 @@ describe('GET /api/streak', () => {
943943
expect(body.details).not.toBeNull();
944944
});
945945
});
946+
it('returns 400 when an invalid hex color is passed as bg', async () => {
947+
const response = await GET(makeRequest({ user: 'octocat', bg: '#ZZZZZZ' }));
946948

949+
expect(response.status).toBe(400);
950+
});
947951
describe('hide parameters', () => {
948952
it('removes the username title when hide_title=true', async () => {
949953
const response = await GET(makeRequest({ user: 'octocat', hide_title: 'true' }));

0 commit comments

Comments
Β (0)