Add TypeScript compiler validation tests for GrowthTrendChart#3664
Add TypeScript compiler validation tests for GrowthTrendChart#3664atul-upadhyay-7 wants to merge 1 commit into
Conversation
Add 5 type-compiler test cases covering baseline property types, invalid shape blocking, structural compatibility, Zod schema validation rejection of out-of-bounds data, and valid payload integrity checks. Closes JhaSourav07#2552
|
👋 Hey @atul-upadhyay-7, it looks like you didn't use our PR template! The section Please update your PR description to include all required sections so we can review this properly:
You can find the full template in CONTRIBUTING.md. Just edit your PR description and the |
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 new type-compiler oriented test suite for GrowthTrendChart to validate prop typing expectations and Zod schema behavior for activity data.
Changes:
- Introduces Vitest
expectTypeOfchecks forGrowthTrendChartprop and item structural typing. - Adds Zod
.strict()runtime validation tests covering invalid and valid activity records.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Aamod007 could you review this |
Aamod007
left a comment
There was a problem hiding this comment.
LGTM! The type validation and zod schema checks are rigorous.
Description
The
GrowthTrendChartcomponent incomponents/dashboard/GrowthTrendChart.tsxhad no type-level test coverage. Its props interface (GrowthTrendChartPropswithactivityA,activityB,labelA,labelB) and the nestedActivityItemshape were untested against TypeScript compiler validation or runtime schema constraints, making it possible for type regressions to slip through during API or prop changes.No test file existed for the component at
components/dashboard/GrowthTrendChart.type-compiler.test.tsx. The component defines a non-exportedGrowthTrendChartPropsinterface and relies on structural typing. Without dedicated type-compiler tests, there was no automated guard ensuring the stability of these type constraints.Fixes #2552
Pillar
Visual Preview
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).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.What changed
components/dashboard/GrowthTrendChart.type-compiler.test.tsxwith 5 test cases:string,number, array shapes)ActivityItemshapes (wrong types, extra optional fields)How to verify
git fetch origin git checkout test/growth-trend-chart-type-compiler npm run test -- components/dashboard/GrowthTrendChart.type-compiler.test.tsxAll 5 tests should pass.