import { render, screen } from '@testing-library/react'; import { CompassHero } from '../CompassHero'; import styles from '@patternfly/react-styles/css/components/Compass/compass'; test('Renders without children', () => { render(
); expect(screen.getByTestId('test-hero').firstChild).toBeVisible(); }); test('Renders with children', () => { render(Test content); expect(screen.getByText('Test content')).toBeVisible(); }); test(`Renders with ${styles.compass}__hero class by defaulty`, () => { render(Test); expect(screen.getByText('Test')).toHaveClass(`${styles.compass}__hero`, { exact: true }); }); test('Renders with custom class name when className prop is provided', () => { render(Test); expect(screen.getByText('Test')).toHaveClass('custom-class'); }); test('Renders with additional props spread to the component', () => { render(Test); expect(screen.getByText('Test')).toHaveAccessibleName('Test label'); }); test('Matches the snapshot', () => { const { asFragment } = render(Hero content); expect(asFragment()).toMatchSnapshot(); });