import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';
import { axe } from 'vitest-axe';
import { MemoryRouter } from 'react-router-dom';
import type { ReactNode } from 'react';
import { LanguageProvider } from '../../contexts/LanguageContext';
import { ThemeProvider } from '../../contexts/ThemeContext';
import LandingPage from '../../pages/LandingPage';
import HomePage from '../../pages/HomePage';
import AuditPage from '../../pages/AuditPage';
import Footer from '../../components/layout/Footer';
function renderPage(children: ReactNode) {
return render(
{children}
);
}
describe('accessibility smoke test', () => {
it('LandingPage has no axe violations', async () => {
const { container } = renderPage();
expect(await axe(container)).toHaveNoViolations();
});
it('HomePage has no axe violations', async () => {
const { container } = renderPage();
expect(await axe(container)).toHaveNoViolations();
});
it('AuditPage has no axe violations', async () => {
const { container } = renderPage();
expect(await axe(container)).toHaveNoViolations();
});
it('Footer keeps the active language for the portfolio link', () => {
renderPage();
const link = screen.getByRole('link', { name: 'Technisches Portfolio' });
expect(link).toHaveAttribute('href', '/de/technical');
});
});