import expect from '@kbn/expect' ; import * as util from '../unsafe_utils' ; import { normalized , breakdown } from './fixtures/breakdown' ; import { inputTimes , normalizedTimes } from './fixtures/normalize_times' ; import { inputIndices , normalizedIndices } from './fixtures/normalize_indices' ; describe ( 'normalizeBreakdown' , function ( ) { it ( 'returns correct breakdown' , function ( ) { const result = util . normalizeBreakdown ( breakdown ) ; expect ( result ) . to . eql ( normalized ) ; } ) ; } ) ; describe ( 'normalizeTime' , function ( ) { it ( 'returns correct normalization' , function ( ) { const totalTime = 0.447365 ; const input = JSON . parse ( JSON . stringify ( inputTimes ) ) ; input . forEach ( ( i ) => util . normalizeTime ( i , totalTime ) ) ; input [ 0 ] . children . forEach ( ( i ) => util . normalizeTime ( i , totalTime ) ) ; expect ( input ) . to . eql ( normalizedTimes ) ; } ) ; } ) ; describe ( 'normalizeIndices' , function ( ) { it ( 'returns correct ordering' , function ( ) { const input = JSON . parse ( JSON . stringify ( inputIndices ) ) ; util . normalizeIndices ( input , 'searches' ) ; const result = util . sortIndices ( input ) ; expect ( result ) . to . eql ( normalizedIndices ) ; } ) ; } ) ;