test(api route): verify 400 error response body is valid JSON#919
Conversation
|
👋 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:
A maintainer will review your PR shortly. Hang tight! 🚀 |
|
👋 Hey @meetparmar392005, 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.
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()toresponse.json() - Verifies
erroranddetailsfields on the JSON error payload
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🚨 Hey @meetparmar392005, the CI Pipeline is failing on this PR and it has been marked as 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 passes2. Auto-fix common issues: npm run format # Auto-fix formatting with Prettier
npm run lint -- --fix # Auto-fix lint errors where possible3. Check the full failure log here: Once you push a fix and the CI passes, the |
|
@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. |
|
🎉 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.
Keep building! 💻✨ |
Description
Fixes #745
Updated the 400 test in
app/api/streak/route.test.tsto properly verifythe response body is valid JSON with the correct structure.
Changes Made:
response.text()withresponse.json()body.error === 'Invalid parameters'typeof body.details === 'object'Pillar
🧪 Testing — Improving test quality and coverage
Checklist
npm run lintpasses locallynpm run testpasses locally (477 tests ✅)