Skip to content

Commit

Permalink
use listener to ensure expects are called
Browse files Browse the repository at this point in the history
  • Loading branch information
astarinmymind committed Mar 24, 2021
1 parent 41eb582 commit 56c1c91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/transaction/TransactionController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ describe('TransactionController', () => {
to: from,
});
controller.cancelTransaction('foo');
await new Promise(async (resolve) => {
const transactionListener = new Promise(async (resolve) => {
controller.hub.once(`${controller.state.transactions[0].id}:finished`, () => {
expect(controller.state.transactions[0].transaction.from).toBe(from);
expect(controller.state.transactions[0].status).toBe(TransactionStatus.rejected);
Expand All @@ -626,6 +626,7 @@ describe('TransactionController', () => {
});
controller.cancelTransaction(controller.state.transactions[0].id);
await expect(result).rejects.toThrow('User rejected the transaction');
await transactionListener;
});

it('should wipe transactions', async () => {
Expand Down

0 comments on commit 56c1c91

Please sign in to comment.