Skip to content

test(stats): add validation and cache behavior coverage#5348

Merged
JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
pari-28:test-4436-stats-route-validation
Jun 13, 2026
Merged

test(stats): add validation and cache behavior coverage#5348
JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
pari-28:test-4436-stats-route-validation

Conversation

@pari-28

@pari-28 pari-28 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #4436

Added app/api/stats/route.validation.test.ts to provide isolated test coverage for the stats API route.

While the issue references theme-contrast behavior, app/api/stats/route.ts is a backend API route and does not render UI elements, styles, or color schemes. The implemented tests therefore focus on the actual runtime behavior exposed by the route.

Added Test Coverage

  • Cache bypass behavior using bypassCache=true
  • Cache status and refresh status header validation
  • User-not-found handling for unresolved GitHub users
  • Refresh rate-limit header verification
  • GitHub API rate-limit error handling

Validation

  • Added 5 test cases
  • Verified locally using Vitest
  • npm run typecheck passes successfully
  • npm run lint reports warnings only (no errors)
  • All new tests passing successfully

Pillar

  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

N/A (test-only change)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally.
  • I have run npm run format, npm run lint, and npm run typecheck locally.
  • My commits follow the Conventional Commits format.
  • I have updated README.md if required. (Not applicable)
  • I have starred 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. (Not applicable)
  • (Recommended) I joined the CommitPulse Discord community.

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@pari-28 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

The PR follows a known pattern of AI-generated superficial test files or inappropriate modifications that provide little to no meaningful runtime coverage and clutter the repository.

Required Changes

Issue 1

  • Problem: The test file creates or simulates interactions on dummy structures, or simply adds redundant tests.
  • Impact: It provides 0 real test coverage.
  • Required Fix: Ensure the PR tests actual new runtime behavior and does not just add redundant tests.

@Aamod-Dev Aamod-Dev added GSSoC 2026 mentor:Aamod007 type:testing Adding, updating, or fixing tests level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Jun 12, 2026
@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jun 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Hey @pari-28, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

Please fix the issues before this can be reviewed. Here's how:

1. Run checks locally before pushing:

npm run format:check   # Check Prettier formatting
npm run lint           # Run ESLint
npm run typecheck      # TypeScript type check
npm run test           # Run unit tests (Vitest)
npm run build          # Verify production build passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

@Aamod-Dev Aamod-Dev added the level:intermediate Moderate complexity tasks label Jun 12, 2026

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contribution! I went through the changes and the testing approach looks very good. Testing cache behavior and rate-limit headers is an important part of backend stability.

I have applied the following labels for scoring:

  • \level:intermediate: Testing the cache status, bypass behavior, and rate limiter interactions requires a good understanding of how the different backend parts interact, even if isolated to a single test file.
  • \ ype:testing: The PR is primarily focused on adding test coverage.
  • \quality:clean: The tests are readable, well-structured, and neatly organized.
  • \mentor:Aamod007\

Thanks again for helping improve our test coverage!

@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 12, 2026
@Aamod-Dev Aamod-Dev removed the level:beginner Small changes Usually isolated fixes or simple UI/text updates. label Jun 13, 2026
@Aamod-Dev Aamod-Dev added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Jun 13, 2026
@github-actions github-actions Bot added this to the GSSoC 2026 milestone Jun 13, 2026
@JhaSourav07 JhaSourav07 merged commit c74f709 into JhaSourav07:main Jun 13, 2026
6 of 7 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @pari-28! Your PR has been successfully merged. 🚀

Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.

⚠️ Important for GSSoC Contributors:
You are strictly advised to join our Discord Server as it is mandatory for all GSSoC participants. All important announcements, point claims, and community discussions happen there.

Keep building! 💻✨

@JhaSourav07 JhaSourav07 added gssoc:approved PR has been reviewed and accepted for valid contribution points and removed gssoc:approved PR has been reviewed and accepted for valid contribution points labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved PR has been reviewed and accepted for valid contribution points GSSoC 2026 level:intermediate Moderate complexity tasks 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(ApiStatsRoute-theme-contrast): verify Dark and Light Prefers-Color-Scheme Visual Cohesion (Variation 3)

3 participants