import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import ErrorMessage from './ErrorMessage'; test('Renders with title', () => { render(); expect(screen.getByText('Error occurred')).toBeVisible(); }); test('Renders with children', () => { render(This is the error message body); expect(screen.getByText('This is the error message body')).toBeVisible(); }); test('Renders with action links', () => { const actionLinks = ( Retry action link ); render(); expect(screen.getByText('Retry action link')).toBeVisible(); }); test('Renders with custom className', () => { render(); expect(screen.getByText('Error occurred').parentElement).toHaveClass('custom-error-class'); }); test('Renders with spread props', () => { render(); expect(screen.getByText('Error occurred').parentElement).toHaveAttribute('id', 'test-error-id'); });