import { Stream } from 'stream' ; import { elasticsearchClientMock } from 'src/core/server/elasticsearch/client/mocks' ; import { ExportListItemsToStreamOptions , GetResponseOptions , WriteNextResponseOptions , WriteResponseHitsToStreamOptions , } from '../items' ; import { LIST_ID , LIST_ITEM_INDEX } from '../../../common/constants.mock' ; import { getSearchListItemMock } from '../../schemas/elastic_response/search_es_list_item_schema.mock' ; export const getExportListItemsToStreamOptionsMock = ( ) : ExportListItemsToStreamOptions => ( { esClient : elasticsearchClientMock . createScopedClusterClient ( ) . asCurrentUser , listId : LIST_ID , listItemIndex : LIST_ITEM_INDEX , stream : new Stream . PassThrough ( ) , stringToAppend : undefined , } ) ; export const getWriteNextResponseOptions = ( ) : WriteNextResponseOptions => ( { esClient : elasticsearchClientMock . createScopedClusterClient ( ) . asCurrentUser , listId : LIST_ID , listItemIndex : LIST_ITEM_INDEX , searchAfter : [ ] , stream : new Stream . PassThrough ( ) , stringToAppend : undefined , } ) ; export const getResponseOptionsMock = ( ) : GetResponseOptions => ( { esClient : elasticsearchClientMock . createScopedClusterClient ( ) . asCurrentUser , listId : LIST_ID , listItemIndex : LIST_ITEM_INDEX , searchAfter : [ ] , size : 100 , } ) ; export const getWriteResponseHitsToStreamOptionsMock = ( ) : WriteResponseHitsToStreamOptions => ( { response : getSearchListItemMock ( ) , stream : new Stream . PassThrough ( ) , stringToAppend : undefined , } ) ;