// @vitest-environment jsdom import { render, screen, cleanup } from '@testing-library/react'; import { describe, it, expect, afterEach, vi } from 'vitest'; import { SkipLink } from '../SkipLink'; // Mock i18n vi.mock('../../../i18n', () => ({ useTranslation: () => ({ t: { nav: { skipToContent: 'Skip to content', }, }, }), })); describe('SkipLink', () => { afterEach(() => { cleanup(); }); it('renders a link with correct href and text', () => { render(); const link = screen.getByRole('link', { name: /skip to content/i }); expect(link).toBeTruthy(); expect(link.getAttribute('href')).toBe('#main-content'); }); it('has class attribute for styling', () => { render(); const link = screen.getByRole('link'); expect(link.getAttribute('class')).toBeTruthy(); }); });