import { Vis } from '../../../visualizations/public' ; import { buildExpression } from '../../../expressions/public' ; import { PieVisParams } from './pie' ; import { samplePieVis } from '../../pie/public/sample_vis.test.mocks' ; import { toExpressionAst } from './to_ast_pie' ; jest . mock ( '../../../expressions/public' , ( ) => ( { ... ( jest . requireActual ( '../../../expressions/public' ) as any ) , buildExpression : jest . fn ( ) . mockImplementation ( ( ) => ( { toAst : ( ) => ( { type : 'expression' , chain : [ ] , } ) , } ) ) , } ) ) ; jest . mock ( './to_ast_esaggs' , ( ) => ( { getEsaggsFn : jest . fn ( ) , } ) ) ; describe ( 'vislib pie vis toExpressionAst function' , ( ) => { let vis ; const params = { timefilter : { } , timeRange : { } , abortSignal : { } , } as any ; beforeEach ( ( ) => { vis = samplePieVis as any ; } ) ; it ( 'should match basic snapshot' , ( ) => { toExpressionAst ( vis , params ) ; const [ , builtExpression ] = ( buildExpression as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ; expect ( builtExpression ) . toMatchSnapshot ( ) ; } ) ; } ) ;