Skip to content

Commit ffc8bb6

Browse files
authored
test(validation): check query validation boundaries for accent param (JhaSourav07#1944)
## Description Fixes JhaSourav07#1442 Program: GSSoC 2026 This PR handles the implementation of validation boundary unit testing for the incoming `?accent=` query parameter under variation 2. Previously, basic parameter checking was evaluated, but checking extreme bounds for incorrect color hex syntax combinations required isolated boundary test coverage to guarantee input schema safety. ### Changes Made * Added 1 target schema validation boundary test case inside `lib/validations.test.ts`. * Mocked an invalid parameter payload passing an accent color string configuration value set to `'#ZZZZZZ'`. * Asserted that the system validation layer catches the hex syntax violation and processes it correctly according to the repository's parsing bounds. ### Why this matters Secures internal configuration mapping engines against structural failures when handling malformed custom color styles, guaranteeing that invalid hex inputs cannot compromise SVG output generation parameters. ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally (`npm run test`). - [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 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). - [x] (Recommended) I joined the CommitPulse Discord server for faster collaboration, mentorship, and PR support.
2 parents 3db36a3 + 8f64bf8 commit ffc8bb6

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/validations.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,20 @@ describe('streakParamsSchema — accent parameter HEX color validation', () => {
740740
expect(result.success).toBe(false);
741741
});
742742

743+
it('rejects the invalid boundary hex color "#ZZZZZZ" for accent', () => {
744+
const result = streakParamsSchema.safeParse({
745+
user: 'octocat',
746+
accent: '#ZZZZZZ',
747+
});
748+
749+
expect(result.success).toBe(false);
750+
if (!result.success) {
751+
expect(result.error.issues[0]?.message).toContain(
752+
'accent must be a valid 3 or 6 character hex color without #'
753+
);
754+
}
755+
});
756+
743757
it('accepts a valid 6-character hex color for accent', () => {
744758
const result = streakParamsSchema.safeParse({
745759
user: 'octocat',

0 commit comments

Comments
 (0)