import { act , renderHook } from '@testing-library/react-hooks' ; import { useExportList } from '@kbn/securitysolution-list-hooks' ; import * as Api from '@kbn/securitysolution-list-api' ; import { httpServiceMock } from '../../../../../../src/core/public/mocks' ; jest . mock ( '@kbn/securitysolution-list-api' ) ; describe ( 'useExportList' , ( ) => { let httpMock ; beforeEach ( ( ) => { httpMock = httpServiceMock . createStartContract ( ) ; ( Api . exportList as jest . Mock ) . mockResolvedValue ( new Blob ( ) ) ; } ) ; it ( 'invokes Api.exportList' , async ( ) => { const { result , waitForNextUpdate } = renderHook ( ( ) => useExportList ( ) ) ; act ( ( ) => { result . current . start ( { http : httpMock , listId : 'list' } ) ; } ) ; await waitForNextUpdate ( ) ; expect ( Api . exportList ) . toHaveBeenCalledWith ( expect . objectContaining ( { http : httpMock , listId : 'list' } ) ) ; } ) ; } ) ;