Skip to content

test(ApiWrappedRoute): add timezone normalization & calendar boundary tests#7937

Open
veeresh4520 wants to merge 4 commits into
JhaSourav07:mainfrom
veeresh4520:test/apiwrapped-timezone-boundaries
Open

test(ApiWrappedRoute): add timezone normalization & calendar boundary tests#7937
veeresh4520 wants to merge 4 commits into
JhaSourav07:mainfrom
veeresh4520:test/apiwrapped-timezone-boundaries

Conversation

@veeresh4520

Copy link
Copy Markdown
Contributor

Fixes #6820

Pillar

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

Summary

Added timezone boundary tests for the wrapped API route covering:

  • Asia/Kolkata timezone forwarding
  • UTC timezone forwarding
  • Requests without timezone
  • Custom year overriding timezone-derived year
  • Refresh requests enabling cache bypass

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally.
  • I have run formatting and lint checks.
  • My commits follow the Conventional Commits format.

Copilot AI review requested due to automatic review settings July 10, 2026 15:00

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 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 (tz present / absent).
  • Adds assertions for custom year overriding timezone-derived year.
  • Adds an assertion that refresh=true results in bypassCache: true.

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

Comment thread app/api/wrapped/route.timezone-boundaries.test.ts
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>
@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 10, 2026
@Aamod007 Aamod007 added mentor:Aamod007 level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests labels Jul 10, 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.

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.
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jul 11, 2026
@github-actions

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 3910.49 KB 3910.49 KB 0 B
Total CSS 326.92 KB 326.92 KB 0 B

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

Labels

level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants