fix: build and test stability for design overhaul
Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Failing after 9m19s
Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Failing after 9m19s
Fixed missing types, import errors, and updated test suites to match the new editorial design. Verified Docker container build.
This commit is contained in:
@@ -1,27 +1,34 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import Header from '@/app/components/Header';
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
// 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', () => {
|
||||
it('renders the header with the dk logo', () => {
|
||||
render(<Header />);
|
||||
expect(screen.getByText('dk')).toBeInTheDocument();
|
||||
expect(screen.getByText('0')).toBeInTheDocument();
|
||||
|
||||
const aboutButtons = screen.getAllByText('About');
|
||||
expect(aboutButtons.length).toBeGreaterThan(0);
|
||||
|
||||
const projectsButtons = screen.getAllByText('Projects');
|
||||
expect(projectsButtons.length).toBeGreaterThan(0);
|
||||
|
||||
const contactButtons = screen.getAllByText('Contact');
|
||||
expect(contactButtons.length).toBeGreaterThan(0);
|
||||
// Check for navigation links
|
||||
expect(screen.getByText('Home')).toBeInTheDocument();
|
||||
expect(screen.getByText('About')).toBeInTheDocument();
|
||||
expect(screen.getByText('Projects')).toBeInTheDocument();
|
||||
expect(screen.getByText('Contact')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders the mobile header', () => {
|
||||
render(<Header />);
|
||||
// Check for mobile menu button (hamburger icon)
|
||||
const menuButton = screen.getByLabelText('Open menu');
|
||||
expect(menuButton).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user