Skip to content

Add TypeScript compiler validation tests for GrowthTrendChart#3664

Open
atul-upadhyay-7 wants to merge 1 commit into
JhaSourav07:mainfrom
atul-upadhyay-7:test/growth-trend-chart-type-compiler
Open

Add TypeScript compiler validation tests for GrowthTrendChart#3664
atul-upadhyay-7 wants to merge 1 commit into
JhaSourav07:mainfrom
atul-upadhyay-7:test/growth-trend-chart-type-compiler

Conversation

@atul-upadhyay-7
Copy link
Copy Markdown
Contributor

@atul-upadhyay-7 atul-upadhyay-7 commented Jun 4, 2026

Description

The GrowthTrendChart component in components/dashboard/GrowthTrendChart.tsx had no type-level test coverage. Its props interface (GrowthTrendChartProps with activityA, activityB, labelA, labelB) and the nested ActivityItem shape 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-exported GrowthTrendChartProps interface 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

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • 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 started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • 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.

What changed

  • Created components/dashboard/GrowthTrendChart.type-compiler.test.tsx with 5 test cases:
    • Case 1: Baseline type assertion for each prop field (string, number, array shapes)
    • Case 2: Static compile-time blocking of invalid ActivityItem shapes (wrong types, extra optional fields)
    • Case 3: Structural compatibility check for minimal and extended props objects
    • Case 4: Zod schema rejection of out-of-bounds activity data with flattened error reporting
    • Case 5: Valid payload parsing with type-level integrity verification

How to verify

git fetch origin
git checkout test/growth-trend-chart-type-compiler
npm run test -- components/dashboard/GrowthTrendChart.type-compiler.test.tsx

All 5 tests should pass.

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
Copilot AI review requested due to automatic review settings June 4, 2026 09:39
@github-actions github-actions Bot added the needs-details This PR is missing required description details. label Jun 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

👋 Hey @atul-upadhyay-7, it looks like you didn't use our PR template!

The section ## Description is missing from your PR description.

Please update your PR description to include all required sections so we can review this properly:

  • ## Description — What does this PR do? Which issue does it fix?
  • ## Pillar — Which contribution pillar does this fall under?
  • ## Checklist — Have you ticked off the quality checklist?

You can find the full template in CONTRIBUTING.md. Just edit your PR description and the needs-details label will be removed automatically. 🙌

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 expectTypeOf checks for GrowthTrendChart prop 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.

Comment thread components/dashboard/GrowthTrendChart.type-compiler.test.tsx
Comment thread components/dashboard/GrowthTrendChart.type-compiler.test.tsx
Comment thread components/dashboard/GrowthTrendChart.type-compiler.test.tsx
Comment thread components/dashboard/GrowthTrendChart.type-compiler.test.tsx
@atul-upadhyay-7
Copy link
Copy Markdown
Contributor Author

@Aamod007 could you review this

Copy link
Copy Markdown
Collaborator

@Aamod007 Aamod007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The type validation and zod schema checks are rigorous.

@Aamod007 Aamod007 added level:advanced Complex contributions involving architecture, optimization, or significant feature work gssoc26 mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests labels Jun 4, 2026
@github-actions github-actions Bot removed the needs-details This PR is missing required description details. label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSSoC 2026 level:advanced Complex contributions involving architecture, optimization, or significant feature work mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(GrowthTrendChart-type-compiler): verify TypeScript Compiler Validation & Schema Constraints Stability (Variation 10)

3 participants