import { render, screen } from '@testing-library/react'; import AppEmptyState from '../AppEmptyState'; const MockSvgComponent = (props: SVGSVGElement) => ( )} /> ); const MockSvg = MockSvgComponent as unknown as React.ComponentType; describe('AppEmptyState', () => { it('should render the title', () => { render(

body

, ); expect(screen.getByText('Test title')).toBeInTheDocument(); }); it('should render the icon when emptyStateImg is an SVG component', () => { render(

body

, ); expect(screen.getByTestId('mock-svg')).toBeInTheDocument(); expect(screen.getByTestId('mock-svg')).toHaveClass('app-empty-state__icon'); }); it('should render the icon when emptyStateImg is a string URL', () => { render(

body

, ); const img = document.querySelector('img[src="/test-image.png"]'); expect(img).toBeInTheDocument(); expect(img).toHaveClass('app-empty-state__icon'); }); it('should apply xl class when isXl is true', () => { render(

body

, ); expect(screen.getByTestId('mock-svg')).toHaveClass('m-is-xl'); }); it('should not apply xl class when isXl is not provided', () => { render(

body

, ); expect(screen.getByTestId('mock-svg')).not.toHaveClass('m-is-xl'); }); it('should render children in the footer', () => { render(

footer content

, ); expect(screen.getByText('footer content')).toBeInTheDocument(); }); });