import { render, screen } from '@testing-library/react';
import { CompassDockMain } from '../CompassDockMain';
import styles from '@patternfly/react-styles/css/components/Compass/compass';
test('Renders without children', () => {
render(
);
expect(screen.getByTestId('test-compass-dock-main').firstChild).toBeVisible();
});
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.compassDockMain} class`, () => {
render(Test);
expect(screen.getByText('Test')).toHaveClass(styles.compassDockMain, { exact: true });
});
test('Renders with additional props spread to the component', () => {
render(Test);
expect(screen.getByText('Test')).toHaveAttribute('id', 'custom-id');
});
test('Matches the snapshot', () => {
const { asFragment } = render(
Test content
);
expect(asFragment()).toMatchSnapshot();
});