Files
portfolio/app/__tests__/components/Header.test.tsx
denshooter 32abc7f3ef
All checks were successful
CI / CD / test-build (push) Successful in 10m13s
CI / CD / deploy-dev (push) Successful in 1m48s
CI / CD / deploy-production (push) Has been skipped
fix: update tests for dk0 logo and boneyard-js mock, add jest moduleNameMapper
2026-04-15 14:37:50 +02:00

35 lines
1.0 KiB
TypeScript

import { render, screen } from '@testing-library/react';
import Header from '@/app/components/Header';
// Mock next-intl
jest.mock('next-intl', () => ({
useLocale: () => 'en',
useTranslations: () => (key: string) => {
const messages: Record<string, string> = {
home: 'Home',
about: 'About',
projects: 'Projects',
contact: 'Contact'
};
return messages[key] || key;
},
}));
// Mock next/navigation
jest.mock('next/navigation', () => ({
usePathname: () => '/en',
}));
describe('Header', () => {
it('renders the header with the dk logo', () => {
render(<Header />);
expect(screen.getByText('dk0')).toBeInTheDocument();
// Check for navigation links (appear in both desktop and mobile menus)
expect(screen.getAllByText('Home').length).toBeGreaterThan(0);
expect(screen.getAllByText('About').length).toBeGreaterThan(0);
expect(screen.getAllByText('Projects').length).toBeGreaterThan(0);
expect(screen.getAllByText('Contact').length).toBeGreaterThan(0);
});
});