import waitForExpect from 'wait-for-expect' ; import { ISearchFeature } from '../index' ; import { exampleEpochData } from './helpers/exampleEpochData' ; import { setupSearchFeature } from './helpers/setup' ; describe ( 'Searching for an epoch' , ( ) => { let search ; beforeEach ( ( ) => { search = setupSearchFeature ( ) ; search . start ( ) ; } ) ; afterEach ( ( ) => { search . stop ( ) ; } ) ; describe ( 'by number' , ( ) => { it ( 'retrieves the epoch with expected data' , async ( ) => { search . actions . searchForEpochByNumber . trigger ( { number : exampleEpochData . number , } ) ; expect ( search . api . searchForEpochByNumberQuery . isExecuting ) . toBe ( true ) ; await waitForExpect ( ( ) => { const { epochSearchResult } = search . store ; expect ( epochSearchResult ?. blocksCount ) . toBe ( '21590' ) ; expect ( epochSearchResult ?. output ) . toBe ( '101402912214.21422' ) ; expect ( epochSearchResult ?. transactionsCount ) . toBe ( '12870' ) ; } ) ; } ) ; } ) ; } ) ;