Skip to content

test: add timezone normalization & calendar boundary tests for TopMet…#7400

Open
veeresh4520 wants to merge 2 commits into
JhaSourav07:mainfrom
veeresh4520:main
Open

test: add timezone normalization & calendar boundary tests for TopMet…#7400
veeresh4520 wants to merge 2 commits into
JhaSourav07:mainfrom
veeresh4520:main

Conversation

@veeresh4520

Copy link
Copy Markdown

…ricsRow

Description

Fixes #7089

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started 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 (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

Copilot AI review requested due to automatic review settings July 4, 2026 10:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.tsx with 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.

Comment on lines +61 to +64
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', '');
Comment thread components/dashboard/PRInsights/TopMetricsRow.timezone-boundaries.test.tsx Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

@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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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', '');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 4, 2026
@veeresh4520

Copy link
Copy Markdown
Author

Fixed the review comments and updated the test cleanup. Also addressed the CI-related issues. Kindly review the latest changes. Thank you!

@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3883.44 KB 3883.44 KB 0 B
Total CSS 323.09 KB 323.09 KB 0 B

@github-actions github-actions Bot added the type:testing Adding, updating, or fixing tests label Jul 4, 2026
@Aamod007 Aamod007 added mentor:Aamod007 level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Jul 4, 2026

@Aamod007 Aamod007 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.

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!

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. status:blocked This PR is blocked due to a failing CI check. type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(TopMetricsRow-timezone-boundaries): verify Timezone Normalization & Calendar Data Boundary Alignment (Variation 8)

3 participants