/** * @jest-environment jsdom */ import { render } from '@testing-library/react'; import { JetpackConnectNotices } from '../jetpack-connect-notices'; const terminalErrorNoticeType = 'siteBlocked'; const nonTerminalErrorNoticeType = 'retryAuth'; const requiredProps = { translate: ( string ) => string }; describe( 'JetpackConnectNotices', () => { test( 'Should render notice', () => { const { container } = render( ); expect( container ).toMatchSnapshot(); } ); test( 'Should not render terminal notice if callback supplied', () => { const onTerminalError = jest.fn(); const { container } = render( ); expect( container ).toBeEmptyDOMElement(); } ); test( 'Should call callback on terminal error', () => { const onTerminalError = jest.fn(); render( ); expect( onTerminalError ).toHaveBeenCalledTimes( 1 ); } ); test( 'Should render non-terminal notice if callback supplied', () => { const onTerminalError = jest.fn(); const { container } = render( ); expect( onTerminalError ).not.toHaveBeenCalled(); expect( container ).toMatchSnapshot(); } ); } );