Skip to content

test: add unit tests for DescriptionSection timezone normalization and calendar boundary alignment#8074

Open
TanCodeX wants to merge 7 commits into
JhaSourav07:mainfrom
TanCodeX:test/description-section-timezone-boundaries
Open

test: add unit tests for DescriptionSection timezone normalization and calendar boundary alignment#8074
TanCodeX wants to merge 7 commits into
JhaSourav07:mainfrom
TanCodeX:test/description-section-timezone-boundaries

Conversation

@TanCodeX

Copy link
Copy Markdown
Contributor

Description

Adds isolated timezone boundary tests for DescriptionSection covering calendar alignment edge cases.

Changes

  • Created app/generator/components/sections/DescriptionSection.timezone-boundaries.test.tsx

  • Added 5 test cases covering:

    • Standard timezone normalization (UTC, EST, IST, JST)
    • Commit alignment across visual calendar dates
    • Leap year boundary handling (Feb 29 → Mar 1)
    • Locale-specific calendar date formatting (en-US, en-GB, de-DE)
    • Daylight Saving Time transition edge cases (America/New_York)

Fixes #6938

Pillar

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

Visual Preview

N/A (test-only changes)

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).
  • I have run the relevant Vitest test suite locally.
  • 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 15, 2026 09:07
@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 15, 2026

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 cover timezone normalization and calendar boundary alignment scenarios for DescriptionSection.

Changes:

  • Introduced DescriptionSection.timezone-boundaries.test.tsx with 5 timezone/date-related test cases.
  • Added assertions for timezone mocking, locale formatting, leap-year boundaries, and DST transitions.

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

import { DescriptionSection } from './DescriptionSection';
import { mockTimezone, restoreTimezone } from '../../../../test-utils/timezone-mock';

describe('DescriptionSection - Timezone Normalization & Calendar Data Boundary Alignment', () => {
Comment on lines +70 to +75
const usFormat = new Intl.DateTimeFormat('en-US', { dateStyle: 'short' }).format(testDate);
expect(usFormat).toBe('10/31/23');

const gbFormat = new Intl.DateTimeFormat('en-GB', { dateStyle: 'short' }).format(testDate);
expect(gbFormat).toBe('31/10/2023');

Comment on lines +76 to +77
const deFormat = new Intl.DateTimeFormat('de-DE', { dateStyle: 'short' }).format(testDate);
expect(deFormat).toBe('31.10.23');
Comment on lines +86 to +100
const formatTime = (d: Date) =>
new Intl.DateTimeFormat('en-US', {
hour: 'numeric',
minute: 'numeric',
timeZoneName: 'short',
}).format(d);

expect(formatTime(beforeDST)).toMatch(/1:59\s*(AM)?\s*EST/);
expect(formatTime(afterDST)).toMatch(/3:00\s*(AM)?\s*EDT/);

const beforeFallBack = new Date('2024-11-03T01:59:59-04:00');
const afterFallBack = new Date('2024-11-03T01:00:00-05:00');

expect(formatTime(beforeFallBack)).toMatch(/1:59\s*(AM)?\s*EDT/);
expect(formatTime(afterFallBack)).toMatch(/1:00\s*(AM)?\s*EST/);

@TanCodeX TanCodeX left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

reviewed

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

github-actions Bot commented Jul 15, 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 3966.23 KB 3966.23 KB 0 B
Total CSS 330.26 KB 330.26 KB 0 B

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests mentor:Aamod007 labels Jul 17, 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.

Good work implementing unit tests for the DescriptionSection timezone normalization and calendar boundary alignment. The tests look comprehensive.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 17, 2026
TanCodeX added 2 commits July 18, 2026 00:23
…//github.com/TanCodeX/commitpulse into test/description-section-timezone-boundaries

# Conflicts:
#	app/api/streak/route.test.ts
#	app/api/streak/tests/dateRange.test.ts
#	app/api/streak/tests/refresh.test.ts
#	app/api/streak/tests/views.test.ts
#	app/api/streak/tests/weekday.test.ts
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jul 17, 2026
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. type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants