import { expect } from 'chai' import { screen, render } from '@testing-library/react' import Notification from '../../../../frontend/js/shared/components/notification' import * as eventTracking from '../../../../frontend/js/infrastructure/event-tracking' import sinon from 'sinon' describe('', function () { let sendMBSpy: sinon.SinonSpy beforeEach(function () { sendMBSpy = sinon.spy(eventTracking, 'sendMB') }) afterEach(function () { sendMBSpy.restore() }) it('renders and is not dismissible by default', function () { render(A notification

} />) screen.getByText('A notification') expect(screen.queryByRole('button', { name: 'Close' })).to.be.null }) it('renders with action', function () { render( A notification

} action={Action} /> ) screen.getByText('A notification') screen.getByRole('link', { name: 'Action' }) }) it('renders with close button', function () { render( A notification

} isDismissible /> ) screen.getByText('A notification') screen.getByRole('button', { name: 'Close' }) }) it('renders with title and content passed as HTML', function () { render( A notification

} title="A title" /> ) screen.getByText('A title') screen.getByText('A notification') }) it('renders with content when passed as a string', function () { render( ) screen.getByText('A notification') }) })