import { mockAppIndexPattern , mockIndexPattern } from '../../rtl_helpers' ; import { getDefaultConfigs } from '../default_configs' ; import { LayerConfig , LensAttributes } from '../lens_attributes' ; import { sampleAttributeCoreWebVital } from '../test_data/sample_attribute_cwv' ; import { LCP_FIELD , SERVICE_NAME , USER_AGENT_OS } from '../constants/elasticsearch_fieldnames' ; import { obsvReportConfigMap } from '../../obsv_exploratory_view' ; describe ( 'Core web vital config test' , function ( ) { mockAppIndexPattern ( ) ; const seriesConfig = getDefaultConfigs ( { reportType : 'core-web-vitals' , dataType : 'ux' , indexPattern : mockIndexPattern , reportConfigMap : obsvReportConfigMap , } ) ; let lnsAttr ; const layerConfig = { seriesConfig , color : 'green' , name : 'test-series' , breakdown : USER_AGENT_OS , indexPattern : mockIndexPattern , time : { from : 'now-15m' , to : 'now' } , reportDefinitions : { [ SERVICE_NAME ] : [ 'elastic-co' ] } , selectedMetricField : LCP_FIELD , } ; beforeEach ( ( ) => { lnsAttr = new LensAttributes ( [ layerConfig ] ) ; } ) ; it ( 'should return expected json' , function ( ) { expect ( lnsAttr . getJSON ( ) ) . toEqual ( sampleAttributeCoreWebVital ) ; } ) ; } ) ;