|
| 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