import { screen } from '@testing-library/react';
import { render } from 'utils/testRenderer';
import { Banner } from './Banner';
test('should render correctly when using basic options', () => {
render(
,
);
expect(
screen.getByText('This is a simple banner message.'),
).toBeInTheDocument();
expect(screen.getByTestId('WarningAmberIcon')).toBeInTheDocument();
});
test('should render correctly when using advanced options', async () => {
render(
,
);
expect(
screen.getByText('This is a more advanced banner message.'),
).toBeInTheDocument();
const link = screen.getByText('Click me');
expect(link).toBeInTheDocument();
link.click();
expect(await screen.findByText('Dialog title')).toBeInTheDocument();
expect(screen.getByText('Dialog content')).toBeInTheDocument();
});
test('should default to info variant when an invalid variant is provided', () => {
render(
,
);
expect(
screen.getByText('This defaulted to an info banner message.'),
).toBeInTheDocument();
expect(screen.getByTestId('InfoOutlinedIcon')).toBeInTheDocument();
});