Files
flyer-crawler.projectium.com/src/components/Footer.test.tsx
Torben Sorensen 2913c7aa09
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Failing after 1m1s
tanstack
2026-01-10 03:20:40 -08:00

31 lines
964 B
TypeScript

// src/components/Footer.test.tsx
import React from 'react';
import { screen } from '@testing-library/react';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { Footer } from './Footer';
import { renderWithProviders } from '../tests/utils/renderWithProviders';
describe('Footer', () => {
beforeEach(() => {
// Set up fake timers to control the date
vi.useFakeTimers();
});
afterEach(() => {
// Restore real timers after each test
vi.useRealTimers();
});
it('should render the copyright notice with the correct year', () => {
// Arrange: Set a specific date for a predictable test outcome
const mockDate = new Date('2025-08-22T10:00:00Z');
vi.setSystemTime(mockDate);
// Act: Render the component
renderWithProviders(<Footer />);
// Assert: Check that the rendered text includes the mocked year
expect(screen.getByText('Copyright 2025-2025')).toBeInTheDocument();
});
});