import expect from '@kbn/expect' ; import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants' ; import { getExceptionResponseMockWithoutAutoGeneratedValues } from '../../../../plugins/lists/common/schemas/response/exception_list_schema.mock' ; import { getCreateExceptionListMinimalSchemaMock } from '../../../../plugins/lists/common/schemas/request/create_exception_list_schema.mock' ; import { FtrProviderContext } from '../../common/ftr_provider_context' ; import { deleteAllExceptions , removeExceptionListServerGeneratedProperties } from '../../utils' ; export default ( { getService } ) : void => { const supertest = getService ( 'supertest' ) ; const log = getService ( 'log' ) ; describe ( 'find_exception_lists' , ( ) => { describe ( 'find exception lists' , ( ) => { afterEach ( async ( ) => { await deleteAllExceptions ( supertest , log ) ; } ) ; it ( 'should return an empty find body correctly if no exception lists are loaded' , async ( ) => { const { body } = await supertest . get ( `${ EXCEPTION_LIST_URL }/_find` ) . set ( 'kbn-xsrf' , 'true' ) . send ( ) . expect ( 200 ) ; expect ( body ) . to . eql ( { data : [ ] , page : 1 , per_page : 20 , total : 0 , } ) ; } ) ; it ( 'should return a single exception list when a single exception list is loaded from a find with defaults added' , async ( ) => { await supertest . post ( EXCEPTION_LIST_URL ) . set ( 'kbn-xsrf' , 'true' ) . send ( getCreateExceptionListMinimalSchemaMock ( ) ) . expect ( 200 ) ; const { body } = await supertest . get ( `${ EXCEPTION_LIST_URL }/_find` ) . set ( 'kbn-xsrf' , 'true' ) . send ( ) . expect ( 200 ) ; body . data = [ removeExceptionListServerGeneratedProperties ( body . data [ 0 ] ) ] ; expect ( body ) . to . eql ( { data : [ getExceptionResponseMockWithoutAutoGeneratedValues ( ) ] , page : 1 , per_page : 20 , total : 1 , } ) ; } ) ; } ) ; } ) ; } ;