import waitForExpect from 'wait-for-expect' ; import { ISearchFeature } from '../index' ; import { examplePaymentAddressData } from './helpers/exampleAddressData' ; import { setupSearchFeature } from './helpers/setup' ; describe ( 'Searching for a payment address summary' , ( ) => { let search ; beforeEach ( ( ) => { search = setupSearchFeature ( ) ; search . start ( ) ; } ) ; afterEach ( ( ) => { search . stop ( ) ; } ) ; it ( 'searches for a summary related to the provided payment address' , async ( ) => { search . actions . searchForPaymentAddress . trigger ( { address : examplePaymentAddressData . address , } ) ; expect ( search . api . searchForPaymentAddressQuery . isExecuting ) . toBe ( true ) ; await waitForExpect ( ( ) => { expect ( search . store ?. paymentAddressSearchResult ?. finalBalance ) . toBe ( examplePaymentAddressData . finalBalance ) ; expect ( search . store ?. paymentAddressSearchResult ?. transactionsCount ) . toBe ( examplePaymentAddressData . transactionsCount ) ; } ) ; } ) ; } ) ;