import { screen } from '@testing-library/react'; import { describe, expect, it } from 'vitest'; import { axeResults } from '@/test/axe'; import { renderWithProviders } from '@/test/renderWithProviders'; import RichParagraph from './RichParagraph'; describe('RichParagraph', () => { it('renders text and links in reading order', async () => { const { container } = await renderWithProviders( , ); expect(container).toHaveTextContent( 'Bekijk mijn portfolio of neem contact op!', ); expect( screen.getByRole('link', { name: 'mijn portfolio' }), ).toHaveAttribute('href', '/portfolio'); expect( screen.getByRole('link', { name: 'neem contact op' }), ).toHaveAttribute('href', '/#contact'); expect(await axeResults(container)).toHaveNoViolations(); }); it('renders a paragraph without links as plain text', async () => { await renderWithProviders(); expect(screen.getByText('Hoi!')).toBeInTheDocument(); expect(screen.queryByRole('link')).not.toBeInTheDocument(); }); });