@@ -308,7 +308,7 @@ describe('Listener', () => {
308
308
const reportedTransactions : Transaction [ ] = [ ] ;
309
309
const listener = new Listener ( 'http://localhost:3000' , namespaceRepo , WebSocketMockAlias ) ;
310
310
listener . open ( ) ;
311
- subscriptionMethod ( listener , alias , hash ) . subscribe ( ( confirmedTransaction ) => {
311
+ subscriptionMethod ( listener , alias ) . subscribe ( ( confirmedTransaction ) => {
312
312
reportedTransactions . push ( confirmedTransaction ) ;
313
313
} ) ;
314
314
@@ -322,7 +322,7 @@ describe('Listener', () => {
322
322
listener . handleMessage (
323
323
{
324
324
topic : name . toString ( ) ,
325
- data : { meta : transferTransactionDTO . meta , transaction : transferTransactionDTO . transaction } ,
325
+ data : { meta : { height : '2' , hash : 'new hash' } , transaction : transferTransactionDTO . transaction } ,
326
326
} ,
327
327
null ,
328
328
) ;
@@ -367,7 +367,7 @@ describe('Listener', () => {
367
367
listener . handleMessage (
368
368
{
369
369
topic : name . toString ( ) ,
370
- data : { meta : transferTransactionDTO . meta , transaction : transferTransactionDTO . transaction } ,
370
+ data : { meta : { height : '1' , hash : 'new hash' } , transaction : transferTransactionDTO . transaction } ,
371
371
} ,
372
372
null ,
373
373
) ;
@@ -408,7 +408,7 @@ describe('Listener', () => {
408
408
listener . handleMessage (
409
409
{
410
410
topic : name . toString ( ) ,
411
- data : { meta : transferTransactionDTO . meta , transaction : transferTransactionDTO . transaction } ,
411
+ data : { meta : { height : '1' , hash : 'new hash' } , transaction : transferTransactionDTO . transaction } ,
412
412
} ,
413
413
null ,
414
414
) ;
@@ -448,7 +448,7 @@ describe('Listener', () => {
448
448
listener . handleMessage (
449
449
{
450
450
topic : name . toString ( ) ,
451
- data : { meta : transferTransactionDTO . meta , transaction : transferTransactionDTO . transaction } ,
451
+ data : { meta : { height : '1' , hash : 'new hash' } , transaction : transferTransactionDTO . transaction } ,
452
452
} ,
453
453
null ,
454
454
) ;
@@ -483,7 +483,7 @@ describe('Listener', () => {
483
483
484
484
const listener = new Listener ( 'http://localhost:3000' , namespaceRepo , WebSocketMock ) ;
485
485
listener . open ( ) ;
486
- subscriptionMethod ( listener , subscribedAddress , hash ) . subscribe ( ( confirmedTransaction ) => {
486
+ subscriptionMethod ( listener , subscribedAddress ) . subscribe ( ( confirmedTransaction ) => {
487
487
reportedTransactions . push ( confirmedTransaction ) ;
488
488
} ) ;
489
489
@@ -497,7 +497,7 @@ describe('Listener', () => {
497
497
listener . handleMessage (
498
498
{
499
499
topic : name . toString ( ) ,
500
- data : { meta : transferTransactionDTO . meta , transaction : transferTransactionDTO . transaction } ,
500
+ data : { meta : { height : '1' , hash : 'new hash' } , transaction : transferTransactionDTO . transaction } ,
501
501
} ,
502
502
null ,
503
503
) ;
@@ -564,16 +564,20 @@ describe('Listener', () => {
564
564
topic : `${ name . toString ( ) } /${ subscribedAddress . plain ( ) } ` ,
565
565
data : { meta : { height : '1' , hash : hash } } ,
566
566
} ;
567
+ const message2 = {
568
+ topic : `${ name . toString ( ) } /${ subscribedAddress . plain ( ) } ` ,
569
+ data : { meta : { height : '1' , hash : 'newHash' } } ,
570
+ } ;
567
571
568
572
const reportedTransactions : string [ ] = [ ] ;
569
573
const listener = new Listener ( 'http://localhost:3000' , namespaceRepo , WebSocketMock ) ;
570
574
listener . open ( ) ;
571
- subscriptionMethod ( listener , subscribedAddress , hash ) . subscribe ( ( confirmedHash ) => {
575
+ subscriptionMethod ( listener , subscribedAddress ) . subscribe ( ( confirmedHash ) => {
572
576
reportedTransactions . push ( confirmedHash ) ;
573
577
} ) ;
574
578
575
579
listener . handleMessage ( message , null ) ;
576
- listener . handleMessage ( message , null ) ;
580
+ listener . handleMessage ( message2 , null ) ;
577
581
578
582
expect ( reportedTransactions . length ) . to . be . equal ( 2 ) ;
579
583
} ) ;
@@ -584,6 +588,10 @@ describe('Listener', () => {
584
588
topic : `${ name . toString ( ) } /${ subscribedAddress . plain ( ) } ` ,
585
589
data : { meta : { height : '1' , hash : hash } } ,
586
590
} ;
591
+ const message2 = {
592
+ topic : `${ name . toString ( ) } /${ subscribedAddress . plain ( ) } ` ,
593
+ data : { meta : { height : '1' , hash : 'newHash' } } ,
594
+ } ;
587
595
588
596
const reportedTransactions : string [ ] = [ ] ;
589
597
const listener = new Listener ( 'http://localhost:3000' , namespaceRepo , WebSocketMock ) ;
@@ -593,7 +601,7 @@ describe('Listener', () => {
593
601
} ) ;
594
602
595
603
listener . handleMessage ( message , null ) ;
596
- listener . handleMessage ( message , null ) ;
604
+ listener . handleMessage ( message2 , null ) ;
597
605
598
606
expect ( reportedTransactions . length ) . to . be . equal ( 2 ) ;
599
607
} ) ;
0 commit comments