test: add timezone normalization & calendar boundary tests for TopMet…#7400
test: add timezone normalization & calendar boundary tests for TopMet…#7400veeresh4520 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Vitest test suite intended to validate timezone normalization and calendar-boundary behavior for the PR Insights TopMetricsRow component (per Issue #7089).
Changes:
- Introduces
TopMetricsRow.timezone-boundaries.test.tsxwith 5 test cases covering multiple timezones, near-midnight shifts, leap day boundary, locale formatting, and DST transition.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| it('2. asserts calculations align commits onto the correct visual dates', () => { | ||
| // Mock the date to near midnight to see if timezone shifts align commits/weeklyActivity correctly | ||
| // 2026-07-04T00:30:00Z is July 4th in UTC, but July 3rd 20:30 in New York (EST/EDT is UTC-4 in July DST) | ||
| const mockUtcDateStr = '2026-07-04T00:30:00Z'; |
|
|
||
| afterEach(() => { | ||
| vi.useRealTimers(); | ||
| vi.stubEnv('TZ', ''); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@veeresh4520 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c92803e39
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| afterEach(() => { | ||
| vi.useRealTimers(); | ||
| vi.stubEnv('TZ', ''); |
There was a problem hiding this comment.
Restore the original TZ after stubbing it
When this suite runs in a worker that started with a non-empty TZ, this hook overwrites it with an empty string instead of restoring the original value. Vitest can reuse the same fork worker for other test files, so any date- or Intl-sensitive tests scheduled after this file may run under a different timezone and become order-dependent; use vi.unstubAllEnvs() or save and restore/delete the original TZ instead.
Useful? React with 👍 / 👎.
|
Fixed the review comments and updated the test cleanup. Also addressed the CI-related issues. Kindly review the latest changes. Thank you! |
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
Hey! Thanks for writing timezone normalization tests for TopMetricsRow. This is a great addition for validating our calendar boundaries across offsets.
I'm assigning level:intermediate, type:testing, and quality:clean.
However, it looks like the Format · Lint · Typecheck · Test CI check is failing. Please take a look at the logs to fix the type or lint errors. Let me know when you've pushed a fix!
|
🚨 Hey @veeresh4520, 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 |
…ricsRow
Description
Fixes #7089
Pillar
Visual Preview
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.