import { setMockValues } from '../../../../__mocks__/kea_logic' ; import React from 'react' ; import { shallow } from 'enzyme' ; import { EuiCallOut } from '@elastic/eui' ; import { CrawlerStatus } from '../types' ; import { CrawlerStatusBanner } from './crawler_status_banner' ; describe ( 'CrawlerStatusBanner' , ( ) => { beforeEach ( ( ) => { jest . clearAllMocks ( ) ; } ) ; [ ( CrawlerStatus . Starting , CrawlerStatus . Running , CrawlerStatus . Canceling ) ] . forEach ( ( status ) => { describe ( `when the status is ${ status }` , ( ) => { it ( 'renders a callout' , ( ) => { setMockValues ( { mostRecentCrawlRequestStatus : status , } ) ; const wrapper = shallow ( < CrawlerStatusBanner />); expect ( wrapper . find ( EuiCallOut ) ) . toHaveLength ( 1 ) ; } ) ; } ) ; } ) ; [ CrawlerStatus . Success , CrawlerStatus . Failed , CrawlerStatus . Canceled , CrawlerStatus . Pending , CrawlerStatus . Suspended , CrawlerStatus . Suspending , ] . forEach ( ( status ) => { describe ( `when the status is ${ status }` , ( ) => { it ( 'does not render a banner/callout' , ( ) => { setMockValues ( { mostRecentCrawlRequestStatus : status , } ) ; const wrapper = shallow ( < CrawlerStatusBanner />); expect ( wrapper . isEmptyRender ( ) ) . toBe ( true ) ; } ) ; } ) ; } ) ; } ) ;