import { shallow } from 'enzyme' ; import React from 'react' ; import { PivotGroupByConfig , PIVOT_SUPPORTED_GROUP_BY_AGGS } from '../../../../common' ; import { GroupByLabelSummary } from './group_by_label_summary' ; describe ( 'Transform: <GroupByLabelSummary />' , ( ) => { test ( 'Date histogram aggregation' , ( ) => { const item = { agg : PIVOT_SUPPORTED_GROUP_BY_AGGS . DATE_HISTOGRAM , field : 'the-group-by-field' , aggName : 'the-group-by-agg-name' , dropDownName : 'the-group-by-drop-down-name' , calendar_interval : '1m' , } ; const props = { item , optionsDataId : 'the-options-data-id' , } ; const wrapper = shallow ( < GroupByLabelSummary { ... props } / > ) ; expect ( wrapper ) . toMatchSnapshot ( ) ; } ) ; test ( 'Histogram aggregation' , ( ) => { const item = { agg : PIVOT_SUPPORTED_GROUP_BY_AGGS . HISTOGRAM , field : 'the-group-by-field' , aggName : 'the-group-by-agg-name' , dropDownName : 'the-group-by-drop-down-name' , interval : '100' , } ; const props = { item , optionsDataId : 'the-options-data-id' , } ; const wrapper = shallow ( < GroupByLabelSummary { ... props } / > ) ; expect ( wrapper ) . toMatchSnapshot ( ) ; } ) ; test ( 'Terms aggregation' , ( ) => { const item = { agg : PIVOT_SUPPORTED_GROUP_BY_AGGS . TERMS , field : 'the-group-by-field' , aggName : 'the-group-by-agg-name' , dropDownName : 'the-group-by-drop-down-name' , } ; const props = { item , optionsDataId : 'the-options-data-id' , } ; const wrapper = shallow ( < GroupByLabelSummary { ... props } / > ) ; expect ( wrapper ) . toMatchSnapshot ( ) ; } ) ; } ) ;