import expect from '@kbn/expect' ; import url from 'url' ; import { FtrProviderContext } from '../../common/ftr_provider_context' ; import archives from '../../common/fixtures/es_archiver/archives_metadata' ; export default function ApiTest ( { getService } ) { const registry = getService ( 'registry' ) ; const supertest = getService ( 'legacySupertestAsApmReadUser' ) ; const archiveName = 'apm_8.0.0' ; const { start , end } = archives [ archiveName ] ; registry . when ( 'Service icons when data is not loaded' , { config : 'basic' , archives : [ ] } , ( ) => { it ( 'handles the empty state' , async ( ) => { const response = await supertest . get ( url . format ( { pathname : `/internal/apm/services/opbeans-java/metadata/icons` , query : { start , end } , } ) ) ; expect ( response . status ) . to . be ( 200 ) ; expect ( response . body ) . to . eql ( { } ) ; } ) ; } ) ; registry . when ( 'Service icons when data is not loaded' , { config : 'basic' , archives : [ archiveName ] } , ( ) => { it ( 'returns java service icons' , async ( ) => { const response = await supertest . get ( url . format ( { pathname : `/internal/apm/services/opbeans-java/metadata/icons` , query : { start , end } , } ) ) ; expect ( response . status ) . to . be ( 200 ) ; expectSnapshot ( response . body ) . toMatchInline ( `
          Object {
            "agentName": "java",
            "cloudProvider": "gcp",
            "containerType": "Kubernetes",
          }
        ` ) ; } ) ; it ( 'returns python service icons' , async ( ) => { const response = await supertest . get ( url . format ( { pathname : `/internal/apm/services/opbeans-python/metadata/icons` , query : { start , end } , } ) ) ; expect ( response . status ) . to . be ( 200 ) ; expectSnapshot ( response . body ) . toMatchInline ( `
          Object {
            "agentName": "python",
            "cloudProvider": "gcp",
            "containerType": "Kubernetes",
          }
        ` ) ; } ) ; } ) ; }