Skip to content

Commit 041399e

Browse files
committed
Unit test fixes
1 parent 1889fcc commit 041399e

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

test/infrastructure/Listener.spec.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ describe('Listener', () => {
308308
const reportedTransactions: Transaction[] = [];
309309
const listener = new Listener('http://localhost:3000', namespaceRepo, WebSocketMockAlias);
310310
listener.open();
311-
subscriptionMethod(listener, alias, hash).subscribe((confirmedTransaction) => {
311+
subscriptionMethod(listener, alias).subscribe((confirmedTransaction) => {
312312
reportedTransactions.push(confirmedTransaction);
313313
});
314314

@@ -322,7 +322,7 @@ describe('Listener', () => {
322322
listener.handleMessage(
323323
{
324324
topic: name.toString(),
325-
data: { meta: transferTransactionDTO.meta, transaction: transferTransactionDTO.transaction },
325+
data: { meta: { height: '2', hash: 'new hash' }, transaction: transferTransactionDTO.transaction },
326326
},
327327
null,
328328
);
@@ -367,7 +367,7 @@ describe('Listener', () => {
367367
listener.handleMessage(
368368
{
369369
topic: name.toString(),
370-
data: { meta: transferTransactionDTO.meta, transaction: transferTransactionDTO.transaction },
370+
data: { meta: { height: '1', hash: 'new hash' }, transaction: transferTransactionDTO.transaction },
371371
},
372372
null,
373373
);
@@ -408,7 +408,7 @@ describe('Listener', () => {
408408
listener.handleMessage(
409409
{
410410
topic: name.toString(),
411-
data: { meta: transferTransactionDTO.meta, transaction: transferTransactionDTO.transaction },
411+
data: { meta: { height: '1', hash: 'new hash' }, transaction: transferTransactionDTO.transaction },
412412
},
413413
null,
414414
);
@@ -448,7 +448,7 @@ describe('Listener', () => {
448448
listener.handleMessage(
449449
{
450450
topic: name.toString(),
451-
data: { meta: transferTransactionDTO.meta, transaction: transferTransactionDTO.transaction },
451+
data: { meta: { height: '1', hash: 'new hash' }, transaction: transferTransactionDTO.transaction },
452452
},
453453
null,
454454
);
@@ -483,7 +483,7 @@ describe('Listener', () => {
483483

484484
const listener = new Listener('http://localhost:3000', namespaceRepo, WebSocketMock);
485485
listener.open();
486-
subscriptionMethod(listener, subscribedAddress, hash).subscribe((confirmedTransaction) => {
486+
subscriptionMethod(listener, subscribedAddress).subscribe((confirmedTransaction) => {
487487
reportedTransactions.push(confirmedTransaction);
488488
});
489489

@@ -497,7 +497,7 @@ describe('Listener', () => {
497497
listener.handleMessage(
498498
{
499499
topic: name.toString(),
500-
data: { meta: transferTransactionDTO.meta, transaction: transferTransactionDTO.transaction },
500+
data: { meta: { height: '1', hash: 'new hash' }, transaction: transferTransactionDTO.transaction },
501501
},
502502
null,
503503
);
@@ -564,16 +564,20 @@ describe('Listener', () => {
564564
topic: `${name.toString()}/${subscribedAddress.plain()}`,
565565
data: { meta: { height: '1', hash: hash } },
566566
};
567+
const message2 = {
568+
topic: `${name.toString()}/${subscribedAddress.plain()}`,
569+
data: { meta: { height: '1', hash: 'newHash' } },
570+
};
567571

568572
const reportedTransactions: string[] = [];
569573
const listener = new Listener('http://localhost:3000', namespaceRepo, WebSocketMock);
570574
listener.open();
571-
subscriptionMethod(listener, subscribedAddress, hash).subscribe((confirmedHash) => {
575+
subscriptionMethod(listener, subscribedAddress).subscribe((confirmedHash) => {
572576
reportedTransactions.push(confirmedHash);
573577
});
574578

575579
listener.handleMessage(message, null);
576-
listener.handleMessage(message, null);
580+
listener.handleMessage(message2, null);
577581

578582
expect(reportedTransactions.length).to.be.equal(2);
579583
});
@@ -584,6 +588,10 @@ describe('Listener', () => {
584588
topic: `${name.toString()}/${subscribedAddress.plain()}`,
585589
data: { meta: { height: '1', hash: hash } },
586590
};
591+
const message2 = {
592+
topic: `${name.toString()}/${subscribedAddress.plain()}`,
593+
data: { meta: { height: '1', hash: 'newHash' } },
594+
};
587595

588596
const reportedTransactions: string[] = [];
589597
const listener = new Listener('http://localhost:3000', namespaceRepo, WebSocketMock);
@@ -593,7 +601,7 @@ describe('Listener', () => {
593601
});
594602

595603
listener.handleMessage(message, null);
596-
listener.handleMessage(message, null);
604+
listener.handleMessage(message2, null);
597605

598606
expect(reportedTransactions.length).to.be.equal(2);
599607
});

0 commit comments

Comments
 (0)