test(components): add timezone normalization and calendar boundary tests for SuccessGuide#7808
Open
ashishraj1504 wants to merge 2 commits into
Open
Conversation
Contributor
|
@ashishraj1504 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Vitest + React Testing Library test suite intended to validate timezone boundary and calendar-date edge cases for the SuccessGuide component.
Changes:
- Introduces
SuccessGuide.timezone-boundaries.test.tsxwith 5 “timezone/leap year/DST/locale format” scenarios. - Adds module mocks for
framer-motionand./Iconsto keep tests renderable in the test environment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+32
to
+52
| it('Case 1: Mock standard global timezone configurations (e.g., America/New_York, Asia/Kolkata, Asia/Tokyo) and verify calculations accurately bind localized metadata onto intended layout timelines', () => { | ||
| const timezones = ['America/New_York', 'Asia/Kolkata', 'Asia/Tokyo']; | ||
| const markdown = ''; | ||
| const onDismiss = vi.fn(); | ||
|
|
||
| timezones.forEach((tz) => { | ||
| mockSystemTimezoneAndDate(tz, '2026-07-04T12:00:00Z'); | ||
|
|
||
| const currentDate = new Date(); | ||
| expect(currentDate.toISOString()).toBe('2026-07-04T12:00:00.000Z'); | ||
|
|
||
| const { unmount } = render(<SuccessGuide markdown={markdown} onDismiss={onDismiss} />); | ||
|
|
||
| expect(screen.getByText('Your Monolith is Ready - Deploy It in 4 Steps')).toBeInTheDocument(); | ||
| expect(screen.getByText('Open Your Profile Repo')).toBeInTheDocument(); | ||
|
|
||
| const snippet = screen.getByLabelText('Your badge markdown snippet'); | ||
| expect(snippet.textContent).toBe(markdown); | ||
|
|
||
| unmount(); | ||
| }); |
Comment on lines
+1
to
+4
| import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; | ||
| import { render, screen, fireEvent } from '@testing-library/react'; | ||
| import type { ReactNode } from 'react'; | ||
| import { SuccessGuide } from './SuccessGuide'; |
Comment on lines
+16
to
+30
| const mockSystemTimezoneAndDate = (timezone: string, dateIsoString: string) => { | ||
| vi.stubEnv('TZ', timezone); | ||
| vi.useFakeTimers(); | ||
| vi.setSystemTime(new Date(dateIsoString)); | ||
| }; | ||
|
|
||
| describe('SuccessGuide Timezone Normalization & Calendar Data Boundary Alignment', () => { | ||
| beforeEach(() => { | ||
| vi.restoreAllMocks(); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| vi.useRealTimers(); | ||
| vi.unstubAllEnvs(); | ||
| }); |
…sts for SuccessGuide
cac295a to
534f137
Compare
Comment on lines
+25
to
+29
| describe('SuccessGuide Timezone Normalization & Calendar Data Boundary Alignment', () => { | ||
| beforeEach(() => { | ||
| vi.restoreAllMocks(); | ||
| }); | ||
|
|
Comment on lines
+85
to
+92
| mockSystemTimezoneAndDate('America/New_York', '2024-03-10T01:59:59-05:00'); | ||
|
|
||
| const beforeTransition = new Date(); | ||
| expect(beforeTransition.getHours()).toBe(1); | ||
|
|
||
| const afterTransition = new Date(beforeTransition.getTime() + 1000); | ||
| expect(afterTransition.getHours()).toBe(3); | ||
|
|
Comment on lines
+119
to
+120
| expect(usFormatted).toBe('7/4/2026'); | ||
| expect(gbFormatted).toBe('04/07/2026'); |
Contributor
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
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
Fixes #6845
Program: GSSoC 2026
This PR introduces an isolated timezone boundary integration test suite at
app/components/SuccessGuide.timezone-boundaries.test.tsxverifying calendar date normalization, leap year rendering, and daylight savings time adjustments withinSuccessGuide.tsx.Changes Made
app/components/SuccessGuide.timezone-boundaries.test.tsxwith 5 dedicated scenarios targeting dynamic timezone environments (UTC, EST, IST, JST).Why this matters
Ensures the documentation calendar frames handle varied global browser offsets seamlessly, preventing regional layout drops or calculation anomalies for international developers viewing instruction metrics.
Pillar
Checklist before requesting a review:
CONTRIBUTING.mdfile.npm run test).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.