test: add unit tests for DescriptionSection timezone normalization and calendar boundary alignment#8074
Open
TanCodeX wants to merge 7 commits into
Open
Conversation
…d calendar boundary alignment
Contributor
There was a problem hiding this comment.
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.tsxwith 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/); |
…e header logic for streak routes
Contributor
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod007
reviewed
Jul 17, 2026
Aamod007
left a comment
Collaborator
There was a problem hiding this comment.
Good work implementing unit tests for the DescriptionSection timezone normalization and calendar boundary alignment. The tests look comprehensive.
…//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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds isolated timezone boundary tests for
DescriptionSectioncovering calendar alignment edge cases.Changes
Created
app/generator/components/sections/DescriptionSection.timezone-boundaries.test.tsxAdded 5 test cases covering:
en-US,en-GB,de-DE)America/New_York)Fixes #6938
Pillar
Visual Preview
N/A (test-only changes)
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.