import { act , renderHook } from '@testing-library/react-hooks' ; import { useFindLists } from '@kbn/securitysolution-list-hooks' ; import * as Api from '@kbn/securitysolution-list-api' ; import { httpServiceMock } from '../../../../../../src/core/public/mocks' ; import { getFoundListSchemaMock } from '../../../common/schemas/response/found_list_schema.mock' ; jest . mock ( '@kbn/securitysolution-list-api' ) ; describe ( 'useFindLists' , ( ) => { let httpMock ; beforeEach ( ( ) => { httpMock = httpServiceMock . createStartContract ( ) ; ( Api . findLists as jest . Mock ) . mockResolvedValue ( getFoundListSchemaMock ( ) ) ; } ) ; it ( 'invokes Api.findLists' , async ( ) => { const { result , waitForNextUpdate } = renderHook ( ( ) => useFindLists ( ) ) ; act ( ( ) => { result . current . start ( { http : httpMock , pageIndex : 1 , pageSize : 10 } ) ; } ) ; await waitForNextUpdate ( ) ; expect ( Api . findLists ) . toHaveBeenCalledWith ( expect . objectContaining ( { http : httpMock , pageIndex : 1 , pageSize : 10 } ) ) ; } ) ; } ) ;