import { render, screen } from '@testing-library/react'; import { CompassContent } from '../CompassContent'; import styles from '@patternfly/react-styles/css/components/Compass/compass'; test('Renders with children', () => { render(Test content); expect(screen.getByText('Test content')).toBeVisible(); }); test('Renders with custom class name when className prop is provided', () => { render(Test); expect(screen.getByText('Test')).toHaveClass('custom-class'); }); test(`Renders with default ${styles.compassContent} class`, () => { render(Test); expect(screen.getByText('Test')).toHaveClass(styles.compassContent); }); test('Renders with drawer when drawerContent is provided', () => { render(Drawer content}>Test); expect(screen.getByText('Drawer content')).toBeVisible(); }); test('Renders with additional props spread to the component', () => { render(Test); expect(screen.getByText('Test')).toHaveAccessibleName('Test label'); }); test('Matches the snapshot without drawer', () => { const { asFragment } = render(
Test content
); expect(asFragment()).toMatchSnapshot(); }); test('Matches the snapshot with drawer', () => { const { asFragment } = render( Drawer content} drawerProps={{ isExpanded: true }}>
Test content
); expect(asFragment()).toMatchSnapshot(); });