From 0c23f5e07e7f5f4c432fde6a2c441a50b1b03ad6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 6 Dec 2017 22:30:08 -0600 Subject: Use rejectedWith --- packages/subproviders/test/unit/ledger_subprovider_test.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts index 3d6a2c49c..bc9671948 100644 --- a/packages/subproviders/test/unit/ledger_subprovider_test.ts +++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts @@ -80,15 +80,10 @@ describe('LedgerSubprovider', () => { describe('failure cases', () => { it('cannot open multiple simultaneous connections to the Ledger device', async () => { const data = ethUtils.bufferToHex(ethUtils.toBuffer('hello world')); - try { - const result = await Promise.all([ - ledgerSubprovider.getAccountsAsync(), - ledgerSubprovider.signPersonalMessageAsync(data), - ]); - throw new Error('Multiple simultaneous calls succeeded when they should have failed'); - } catch (err) { - expect(err.message).to.be.equal(LedgerSubproviderErrors.MultipleOpenConnectionsDisallowed); - } + return expect(Promise.all([ + ledgerSubprovider.getAccountsAsync(), + ledgerSubprovider.signPersonalMessageAsync(data), + ])).to.be.rejectedWith(LedgerSubproviderErrors.MultipleOpenConnectionsDisallowed); }); }); }); -- cgit v1.2.3