Skip to content

Commit d5ed2e8

Browse files
authored
test(feature-cards): add timezone boundary coverage (JhaSourav07#3225)
## Description Fixes JhaSourav07#2750 Added isolated unit tests for `components/FeatureCards.tsx` focusing on rendering stability across timezone-related content and calendar boundary scenarios. ### Changes - Added `components/FeatureCards.timezone-boundaries.test.tsx` - Mocked GSAP and ScrollTrigger dependencies to isolate component rendering - Verified rendering remains stable with UTC-related content - Tested rendering with EST and IST timezone boundary references - Confirmed leap-year date references render without errors - Verified daylight-saving transition content renders correctly - Tested section heading rendering and overall layout integrity - Improved coverage around boundary-oriented content rendering scenarios ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [x] 🕐 Pillar 3 — Timezone Logic Optimization - [ ] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview N/A (test-only changes) ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally. - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors (CI will fail otherwise). - [x] 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. - [x] I have starred the repo. - [x] I have made sure that I have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no visual changes made). - [ ] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents 1355277 + 32de953 commit d5ed2e8

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// components/FeatureCards.timezone-boundaries.test.tsx
2+
3+
import { describe, expect, it, vi } from 'vitest';
4+
import { render, screen } from '@testing-library/react';
5+
import '@testing-library/jest-dom';
6+
7+
vi.mock('gsap', () => ({
8+
default: {
9+
set: vi.fn(),
10+
to: vi.fn(),
11+
fromTo: vi.fn(),
12+
registerPlugin: vi.fn(),
13+
context: vi.fn((callback: () => void) => {
14+
callback();
15+
16+
return {
17+
revert: vi.fn(),
18+
};
19+
}),
20+
timeline: vi.fn(() => ({
21+
to: vi.fn().mockReturnThis(),
22+
set: vi.fn().mockReturnThis(),
23+
fromTo: vi.fn().mockReturnThis(),
24+
kill: vi.fn(),
25+
})),
26+
},
27+
}));
28+
29+
vi.mock('gsap/ScrollTrigger', () => ({
30+
ScrollTrigger: {},
31+
}));
32+
33+
import { FeatureCardsSection } from './FeatureCards';
34+
35+
describe('FeatureCards Timezone Boundaries', () => {
36+
it('renders successfully with UTC boundary content', () => {
37+
render(
38+
<FeatureCardsSection>
39+
<div>UTC Activity Data</div>
40+
</FeatureCardsSection>
41+
);
42+
43+
expect(screen.getByText('UTC Activity Data')).toBeInTheDocument();
44+
});
45+
46+
it('renders successfully with EST and IST boundary content', () => {
47+
render(
48+
<FeatureCardsSection>
49+
<div>EST to IST Transition</div>
50+
</FeatureCardsSection>
51+
);
52+
53+
expect(screen.getByText('EST to IST Transition')).toBeInTheDocument();
54+
});
55+
56+
it('renders successfully with leap year references', () => {
57+
render(
58+
<FeatureCardsSection>
59+
<div>February 29 2024</div>
60+
</FeatureCardsSection>
61+
);
62+
63+
expect(screen.getByText('February 29 2024')).toBeInTheDocument();
64+
});
65+
66+
it('renders successfully with daylight savings references', () => {
67+
render(
68+
<FeatureCardsSection>
69+
<div>DST Transition Date</div>
70+
</FeatureCardsSection>
71+
);
72+
73+
expect(screen.getByText('DST Transition Date')).toBeInTheDocument();
74+
});
75+
76+
it('renders section heading correctly', () => {
77+
render(
78+
<FeatureCardsSection>
79+
<div>Content</div>
80+
</FeatureCardsSection>
81+
);
82+
83+
expect(
84+
screen.getByRole('heading', {
85+
name: /why commitpulse/i,
86+
})
87+
).toBeInTheDocument();
88+
});
89+
});

0 commit comments

Comments
 (0)