import expect from '@kbn/expect' ; import { nullUser } from '../../../../common/lib/mock' ; import { FtrProviderContext } from '../../../../common/ftr_provider_context' ; import { removeServerGeneratedPropertiesFromSavedObject , getConfigurationOutput , deleteConfiguration , getConfiguration , createConfiguration , getConfigurationRequest , getAuthWithSuperUser , } from '../../../../common/lib/utils' ; export default ( { getService } ) : void => { const supertest = getService ( 'supertest' ) ; const es = getService ( 'es' ) ; const authSpace1 = getAuthWithSuperUser ( ) ; describe ( 'get_configure' , ( ) => { afterEach ( async ( ) => { await deleteConfiguration ( es ) ; } ) ; it ( 'should return a configuration in space1' , async ( ) => { await createConfiguration ( supertest , getConfigurationRequest ( ) , 200 , authSpace1 ) ; const configuration = await getConfiguration ( { supertest , auth : authSpace1 } ) ; const data = removeServerGeneratedPropertiesFromSavedObject ( configuration [ 0 ] ) ; expect ( data ) . to . eql ( getConfigurationOutput ( false , { created_by : nullUser } ) ) ; } ) ; it ( 'should not find a configuration when looking in a different space' , async ( ) => { await createConfiguration ( supertest , getConfigurationRequest ( ) , 200 , authSpace1 ) ; const configuration = await getConfiguration ( { supertest , auth : getAuthWithSuperUser ( 'space2' ) , } ) ; expect ( configuration ) . to . eql ( [ ] ) ; } ) ; } ) ; } ;