Add unit tests for core components and layouts
- **ThemeToggle:** Introduce comprehensive tests to validate button functionality, dropdown options, and active theme indicators. - **ThemeProvider:** Add tests for theme management, localStorage persistence, system preferences, and DOM updates. - **Header & Footer:** Verify header rendering, user menu functionality, and footer content consistency. - **AuthInitializer:** Ensure authentication state is correctly loaded from storage on mount.
This commit is contained in:
33
frontend/tests/components/layout/Footer.test.tsx
Normal file
33
frontend/tests/components/layout/Footer.test.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Tests for Footer Component
|
||||
* Verifies footer rendering and content
|
||||
*/
|
||||
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { Footer } from '@/components/layout/Footer';
|
||||
|
||||
describe('Footer', () => {
|
||||
describe('Rendering', () => {
|
||||
it('renders footer element', () => {
|
||||
const { container } = render(<Footer />);
|
||||
|
||||
const footer = container.querySelector('footer');
|
||||
expect(footer).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('displays copyright text with current year', () => {
|
||||
render(<Footer />);
|
||||
|
||||
const currentYear = new Date().getFullYear();
|
||||
expect(screen.getByText(`© ${currentYear} FastNext Template. All rights reserved.`)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('applies correct styling classes', () => {
|
||||
const { container } = render(<Footer />);
|
||||
|
||||
const footer = container.querySelector('footer');
|
||||
expect(footer).toHaveClass('border-t');
|
||||
expect(footer).toHaveClass('bg-muted/30');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user