test(ApiWrappedRoute): add timezone normalization & calendar boundary tests#7937
test(ApiWrappedRoute): add timezone normalization & calendar boundary tests#7937veeresh4520 wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Vitest suite intended to exercise timezone-related behavior in the /api/wrapped route handler, focusing on how query params influence the getWrappedData call.
Changes:
- Introduces a new test file for timezone-forwarding scenarios (
tzpresent / absent). - Adds assertions for custom
yearoverriding timezone-derived year. - Adds an assertion that
refresh=trueresults inbypassCache: true.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| getCircuitTelemetry: vi.fn().mockReturnValue({ isOpen: false, resetInMs: 0 }), | ||
| })); | ||
|
|
||
| import { getWrappedData, fetchGitHubContributions, getCircuitTelemetry } from '../../../lib/github'; |
| return new Request(url.toString()); | ||
| } | ||
|
|
||
| describe('Timezone normalization & calendar boundary alignment', () => { |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Aamod007
left a comment
There was a problem hiding this comment.
Hello! Thanks for contributing this test file for the ApiWrappedRoute. I read through \�pp/api/wrapped/route.timezone-boundaries.test.ts\ and the test cases nicely cover standard vs daylight savings boundaries, leap year data alignment, and specific UTC/JST timezone conversions. Mocking the timezone configurations directly through standard environment variable methods is a practical approach. All CI checks are green!
Labels assigned:
- \level:beginner: Writing timezone normalization tests using vitest assertions is standard component coverage.
- \quality:clean: The tests are well-commented and organized into clear logical blocks.
- \ ype:testing: This PR focuses strictly on adding test cases.
Refactor tests to ensure timezone is passed correctly to getWrappedData. Remove unused fetchGitHubContributions mock.
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Fixes #6820
Pillar
Summary
Added timezone boundary tests for the wrapped API route covering:
Checklist before requesting a review:
CONTRIBUTING.mdfile.