import expect from '@kbn/expect' ; import { FtrProviderContext } from '../../../../common/ftr_provider_context' ; import { getPostCaseRequest } from '../../../../common/lib/mock' ; import { deleteAllCaseItems , createCase , getCaseUserActions , getAuthWithSuperUser , } from '../../../../common/lib/utils' ; export default ( { getService } ) : void => { const supertest = getService ( 'supertest' ) ; const es = getService ( 'es' ) ; const authSpace1 = getAuthWithSuperUser ( ) ; describe ( 'get_all_user_actions' , ( ) => { afterEach ( async ( ) => { await deleteAllCaseItems ( es ) ; } ) ; it ( `should get user actions in space1` , async ( ) => { const postedCase = await createCase ( supertest , getPostCaseRequest ( ) , 200 , authSpace1 ) ; const body = await getCaseUserActions ( { supertest , caseID : postedCase . id , auth : authSpace1 } ) ; expect ( body . length ) . to . eql ( 1 ) ; } ) ; it ( `should not get user actions in the wrong space` , async ( ) => { const postedCase = await createCase ( supertest , getPostCaseRequest ( ) , 200 , authSpace1 ) ; const body = await getCaseUserActions ( { supertest , caseID : postedCase . id , auth : getAuthWithSuperUser ( 'space2' ) , } ) ; expect ( body . length ) . to . eql ( 0 ) ; } ) ; } ) ; } ;