import expect from '@kbn/expect' ; import { FtrProviderContext } from '../services' ; export default function ( { getService } ) { const esArchiver = getService ( 'esArchiver' ) ; const usageAPI = getService ( 'usageAPI' ) ; describe ( 'saved_object_tagging usage collector data' , ( ) => { beforeEach ( async ( ) => { await esArchiver . load ( 'x-pack/test/saved_object_tagging/common/fixtures/es_archiver/usage_collection' ) ; } ) ; afterEach ( async ( ) => { await esArchiver . unload ( 'x-pack/test/saved_object_tagging/common/fixtures/es_archiver/usage_collection' ) ; } ) ; it ( 'collects the expected data' , async ( ) => { const [ { stats : telemetryStats } ] = ( await usageAPI . getTelemetryStats ( { unencrypted : true , refreshCache : true , } ) ) as any ; const taggingStats = telemetryStats . stack_stats . kibana . plugins . saved_objects_tagging ; expect ( taggingStats ) . to . eql ( { usedTags : 4 , taggedObjects : 5 , types : { dashboard : { taggedObjects : 2 , usedTags : 3 , } , visualization : { taggedObjects : 3 , usedTags : 2 , } , } , } ) ; } ) ; } ) ; }