import waitForExpect from 'wait-for-expect' ; import { graphqlClient } from '../../../lib/graphql/graphqlClient' ; import { createNetworkInfoFeature , INetworkInfoFeature } from '../index' ; describe ( 'Network information' , ( ) => { let networkInfo ; beforeEach ( async ( ) => { networkInfo = createNetworkInfoFeature ( graphqlClient ) ; await networkInfo . start ( ) ; } ) ; afterEach ( ( ) => { networkInfo . stop ( ) ; } ) ; it ( 'separates static and dynamic network fetching' , async ( ) => { networkInfo . actions . fetchStatic . trigger ( { } ) ; networkInfo . actions . fetchDynamic . trigger ( { } ) ; expect ( networkInfo . api . fetchStatic . isExecuting ) . toBe ( true ) ; expect ( networkInfo . api . fetchDynamic . isExecuting ) . toBe ( true ) ; await waitForExpect ( ( ) => { expect ( networkInfo . store . blockHeight ) . toBeGreaterThan ( 4000893 ) ; expect ( networkInfo . store . currentEpoch ) . toBeGreaterThan ( 184 ) ; } ) ; } ) ; } ) ;