test(validation): check query validation boundaries for theme param#1955
test(validation): check query validation boundaries for theme param#1955ashishraj1504 wants to merge 1 commit into
Conversation
|
@ashishraj1504 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a test verifying that an invalid theme value falls back to 'dark' in ogParamsSchema.
Changes:
- New test case asserting fallback behavior for unrecognized theme values.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| it('should parse an invalid theme value back to dark', () => { | ||
| const result = ogParamsSchema.parse({ theme: 'nonexistent_theme_name' }); | ||
|
|
||
| expect(result.theme).toBe('dark'); | ||
| }); |
Aamod007
left a comment
There was a problem hiding this comment.
This test duplicates the existing should fallback to "dark" when an invalid theme is provided at line 691. Both test theme: 'nonexistent_theme_name' falling back to 'dark', just using .parse() instead of .safeParse(). No new coverage is added.
Please either remove this test or add a theme boundary case that isn't already covered.
0a25f0a to
03913e9
Compare
|
@Aamod007 , Thank you for the guidance! You're completely right—testing I have repurposed the test case to target an empty string boundary ( |
Description
Fixes #1447
Program: GSSoC 2026
This PR handles the implementation of validation boundary unit testing for the incoming
?theme=query parameter under variation 3.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
lib/validations.test.ts.'nonexistent_theme_name'.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
Checklist before requesting a review:
CONTRIBUTING.mdfile.npm run test).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.