import { render, screen } from '@testing-library/react'; import { SimpleCard } from '../../src/utils/SimpleCard'; describe('', () => { it('does not render title if not provided', () => { render(); expect(screen.queryByRole('heading')).not.toBeInTheDocument(); }); it('renders provided title', () => { render(); expect(screen.getByRole('heading')).toHaveTextContent('Cool title'); }); it('renders children inside body', () => { render(Hello world); expect(screen.getByText('Hello world')).toBeInTheDocument(); }); it.each(['primary', 'danger', 'warning'])('passes extra props to nested card', (color) => { const { container } = render(Hello world); expect(container.firstChild).toHaveAttribute('class', `foo card bg-${color}`); }); });