Skip to content

Commit 3f67948

Browse files
committed
Fixed transactionHttp unit test
1 parent 46141f9 commit 3f67948

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/infrastructure/TransactionHttp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export class TransactionHttp extends Http implements TransactionRepository {
166166
*/
167167
public announceAggregateBonded(signedTransaction: SignedTransaction): Observable<TransactionAnnounceResponse> {
168168
if (signedTransaction.type !== TransactionType.AGGREGATE_BONDED) {
169-
throwError('Only Transaction Type 0x4241 is allowed for announce aggregate bonded');
169+
throw new Error('Only Transaction Type 0x4241 is allowed for announce aggregate bonded');
170170
}
171171
return observableFrom(this.transactionRoutesApi.announcePartialTransaction(signedTransaction)).pipe(
172172
map((response: { response: ClientResponse; body: AnnounceTransactionInfoDTO; } ) => {

test/infrastructure/TransactionHttp.spec.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@ describe('TransactionHttp', () => {
4646

4747
const signedTx = account.sign(aggTx, generationHash);
4848
const trnsHttp = new TransactionHttp(NIS2_URL);
49-
return trnsHttp.announceAggregateBonded(signedTx)
49+
expect(() => {
50+
trnsHttp.announceAggregateBonded(signedTx)
5051
.toPromise()
51-
.then(() => {
52-
})
53-
.catch((reason) => {
54-
expect(reason.toString()).to.be.equal('Only Transaction Type 0x4241 is allowed for announce aggregate bonded');
55-
});
52+
.then();
53+
}).to.throw(Error, 'Only Transaction Type 0x4241 is allowed for announce aggregate bonded');
5654
});
5755
});

0 commit comments

Comments
 (0)