import { waitFor } from '@testing-library/react' import * as React from 'react' import renderWithTheme from '../../tests/helpers/renderWithTheme' import Alert from './Alert' describe('component: Alert', (): void => { test('Should render the inner text', (): void => { const { getByText } = renderWithTheme(Message) expect(getByText('Message')).toBeInTheDocument() }) test('should support flex item props', () => { const { getByTestId } = renderWithTheme( I have flex props ) const alert = getByTestId('flex-alert') expect(alert).toHaveStyle('flex: 1') expect(alert).toHaveStyle('flex-grow: 1') expect(alert).toHaveStyle('flex-shrink: 0') expect(alert).toHaveStyle('flex-basis: 0') }) test('Should call the onClose fn after timeout', async () => { const setOpen = jest.fn() const { queryByText } = renderWithTheme( Notification ) expect(queryByText('Notification')).toBeInTheDocument() await waitFor(() => expect(setOpen).toHaveBeenCalled()) }) })