Skip to content

test(api route): verify 400 error response body is valid JSON#919

Merged
JhaSourav07 merged 2 commits into
JhaSourav07:mainfrom
meetparmar392005:fix/issue-745-json-assertion
May 28, 2026
Merged

test(api route): verify 400 error response body is valid JSON#919
JhaSourav07 merged 2 commits into
JhaSourav07:mainfrom
meetparmar392005:fix/issue-745-json-assertion

Conversation

@meetparmar392005
Copy link
Copy Markdown
Contributor

@meetparmar392005 meetparmar392005 commented May 28, 2026

Description

Fixes #745

Updated the 400 test in app/api/streak/route.test.ts to properly verify
the response body is valid JSON with the correct structure.

Changes Made:

  • Replaced response.text() with response.json()
  • Added assertion: body.error === 'Invalid parameters'
  • Added assertion: typeof body.details === 'object'

Pillar

🧪 Testing — Improving test quality and coverage

Checklist

  • I have read CONTRIBUTING.md
  • npm run lint passes locally
  • npm run test passes locally (477 tests ✅)
  • No SVG output changes (test-only PR)

Copilot AI review requested due to automatic review settings May 28, 2026 10:13
@github-actions github-actions Bot added the needs-details This PR is missing required description details. label May 28, 2026
@github-actions
Copy link
Copy Markdown

👋 Hey @meetparmar392005, welcome to CommitPulse! 🎉

Thanks for opening your first pull request — this is a big deal and we appreciate the effort!

While you wait for a review, please double-check:

  • ✅ You've read the CONTRIBUTING.md checklist
  • npm run lint, npm run format, and npm run test all pass locally
  • ✅ Your PR has a visual preview if it touches any SVG output
  • 💬 You've joined our Discord for faster PR feedback

A maintainer will review your PR shortly. Hang tight! 🚀

@github-actions
Copy link
Copy Markdown

👋 Hey @meetparmar392005, 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.

Updates the GET /api/streak test to assert a structured JSON error response (instead of plain text) for invalid requests.

Changes:

  • Switches error-body parsing from response.text() to response.json()
  • Verifies error and details fields on the JSON error payload

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/api/streak/route.test.ts
@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label May 28, 2026
@github-actions
Copy link
Copy Markdown

🚨 Hey @meetparmar392005, 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. 💪

@github-actions github-actions Bot removed the needs-details This PR is missing required description details. label May 28, 2026
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 28, 2026

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

A member of the Team first needs to authorize it.

@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label May 28, 2026
Aamod007
Aamod007 previously approved these changes May 28, 2026
@Aamod007 Aamod007 dismissed their stale review May 28, 2026 13:36

Make PR according to guidelines

@github-actions github-actions Bot added the type:testing Adding, updating, or fixing tests label May 28, 2026
@JhaSourav07 JhaSourav07 added GSSoC 2026 level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:exceptional Outstanding contribution with exceptional implementation quality, testing. gssoc:approved PR has been reviewed and accepted for valid contribution points mentor:Aamod007 labels May 28, 2026
@JhaSourav07 JhaSourav07 merged commit 4fc881c into JhaSourav07:main May 28, 2026
6 of 7 checks passed
@github-actions github-actions Bot added this to the GSSoC 2026 milestone May 28, 2026
@github-actions
Copy link
Copy Markdown

🎉 Congratulations @meetparmar392005! 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! 💻✨

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:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:exceptional Outstanding contribution with exceptional implementation quality, testing. type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(api route): verify 400 error response body is valid JSON

4 participants