import { SavedObjectsClientContract } from 'kibana/server' ; import { NamespaceType } from '@kbn/securitysolution-io-ts-list-types' ; import { savedObjectsClientMock } from '../../../../../../../../src/core/server/mocks' ; import { deleteExceptionListItemByList } from '../../delete_exception_list_items_by_list' ; import { deleteListItemsToBeOverwritten } from './delete_list_items_to_overwrite' ; jest . mock ( '../../delete_exception_list_items_by_list' ) ; describe ( 'deleteListItemsToBeOverwritten' , ( ) => { const sampleListItemsToDelete = [ [ 'list-id' , 'single' ] , [ 'list-id-2' , 'agnostic' ] , ] ; let savedObjectsClient ; beforeEach ( ( ) => { savedObjectsClient = savedObjectsClientMock . create ( ) ; } ) ; it ( 'returns empty array if no items to create' , async ( ) => { await deleteListItemsToBeOverwritten ( { listsOfItemsToDelete : sampleListItemsToDelete , savedObjectsClient , } ) ; expect ( deleteExceptionListItemByList ) . toHaveBeenNthCalledWith ( 1 , { listId : 'list-id' , namespaceType : 'single' , savedObjectsClient , } ) ; expect ( deleteExceptionListItemByList ) . toHaveBeenNthCalledWith ( 2 , { listId : 'list-id-2' , namespaceType : 'agnostic' , savedObjectsClient , } ) ; } ) ; } ) ;