@@ -419,6 +419,60 @@ describe('RaidenService', () => {
419419 config . web3 . eth = eth ;
420420 } ) ) ;
421421
422+ it ( 'should retry polling the balance when rpc connection attempt was successful' , fakeAsync ( ( ) => {
423+ let count = 0 ;
424+ const raidenConfig = TestBed . inject ( RaidenConfig ) ;
425+
426+ const eth = raidenConfig . web3 . eth ;
427+
428+ // @ts -ignore
429+ raidenConfig . web3 . eth = {
430+ getBalance ( address : string ) : Promise < string > {
431+ return Promise . reject ( ) ;
432+ } ,
433+ } ;
434+
435+ tick ( 15000 ) ;
436+
437+ const subscription = service . balance$ . subscribe ( ( value ) => {
438+ expect ( value ) . toEqual ( '2' ) ;
439+ count ++ ;
440+ } ) ;
441+
442+ mockHttp
443+ . expectOne ( {
444+ url : `${ endpoint } /address` ,
445+ method : 'GET' ,
446+ } )
447+ . flush (
448+ {
449+ our_address : raidenAddress ,
450+ } ,
451+ {
452+ status : 200 ,
453+ statusText : '' ,
454+ }
455+ ) ;
456+
457+ // @ts -ignore
458+ raidenConfig . web3 . eth = {
459+ getBalance ( address : string ) : Promise < string > {
460+ return Promise . resolve (
461+ new BigNumber ( '2000000000000000000' ) . toString ( )
462+ ) ;
463+ } ,
464+ } ;
465+
466+ const loadSpy = spyOn ( raidenConfig , 'load' ) ;
467+ loadSpy . and . returnValue ( Promise . resolve ( true ) ) ;
468+ service . attemptRpcConnection ( ) ;
469+
470+ flush ( ) ;
471+ expect ( count ) . toEqual ( 1 ) ;
472+ subscription . unsubscribe ( ) ;
473+ raidenConfig . web3 . eth = eth ;
474+ } ) ) ;
475+
422476 it ( 'should notify the user when a deposit was complete successfully' , fakeAsync ( ( ) => {
423477 const channel = createChannel ( {
424478 channel_identifier : new BigNumber ( 1 ) ,
0 commit comments