import { ShardSerialized } from '../../../types' ; jest . mock ( '../constants' , ( ) => ( { MAX_TREE_DEPTH : 3 , } ) ) ; import { initDataFor } from '../init_data' ; import { searchResponse } from './fixtures/search_response' ; import { processedResponseWithFirstShard } from './fixtures/processed_search_response' ; describe ( 'ProfileTree init data' , ( ) => { test ( 'provides the expected result' , ( ) => { const input = searchResponse as any ; const actual = initDataFor ( 'searches' ) ( input ) ; expect ( actual [ 1 ] . shards [ 0 ] . searches ! [ 0 ] . treeRoot ! . children [ 0 ] . children [ 0 ] . children [ 0 ] . children ) . toEqual ( [ ] ) ; expect ( actual [ 0 ] . name ) . toEqual ( processedResponseWithFirstShard [ 0 ] . name ) ; const expectedFirstShard = processedResponseWithFirstShard [ 0 ] . shards [ 0 ] ; expect ( actual [ 0 ] . shards [ 0 ] ) . toEqual ( expectedFirstShard ) ; } ) ; } ) ;