import { setMockActions } from '../../../__mocks__/kea_logic' ; import '../../../__mocks__/shallow_useeffect.mock' ; import '../../__mocks__/engine_logic.mock' ; import React from 'react' ; import { shallow , ShallowWrapper } from 'enzyme' ; import { CrawlerOverview } from './crawler_overview' ; import { CrawlerRouter } from './crawler_router' ; import { CrawlerSingleDomain } from './crawler_single_domain' ; describe ( 'CrawlerRouter' , ( ) => { const mockActions = { fetchCrawlerData : jest . fn ( ) , } ; let wrapper ; beforeEach ( ( ) => { jest . clearAllMocks ( ) ; setMockActions ( mockActions ) ; wrapper = shallow ( < CrawlerRouter />); } ) ; it ( 'calls fetchCrawlerData and starts polling on page load' , ( ) => { expect ( mockActions . fetchCrawlerData ) . toHaveBeenCalledTimes ( 1 ) ; } ) ; it ( 'renders a crawler views' , ( ) => { expect ( wrapper . find ( CrawlerOverview ) ) . toHaveLength ( 1 ) ; expect ( wrapper . find ( CrawlerSingleDomain ) ) . toHaveLength ( 1 ) ; } ) ; } ) ;