diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-06-06 17:39:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-06 17:39:03 +0800 |
commit | b1ecb45f1bf5fed0762e7f17b00f46ae6fdc6b56 (patch) | |
tree | 0bd44ebb60174d70c8c3e987fb037dad26c1edb9 | |
parent | 06c6ae0dbd0138d872b2ad0519e3b316b67ad470 (diff) | |
parent | 713ad291c4d4c537ef142e332566555076708b6d (diff) | |
download | dexon-sol-tools-b1ecb45f1bf5fed0762e7f17b00f46ae6fdc6b56.tar dexon-sol-tools-b1ecb45f1bf5fed0762e7f17b00f46ae6fdc6b56.tar.gz dexon-sol-tools-b1ecb45f1bf5fed0762e7f17b00f46ae6fdc6b56.tar.bz2 dexon-sol-tools-b1ecb45f1bf5fed0762e7f17b00f46ae6fdc6b56.tar.lz dexon-sol-tools-b1ecb45f1bf5fed0762e7f17b00f46ae6fdc6b56.tar.xz dexon-sol-tools-b1ecb45f1bf5fed0762e7f17b00f46ae6fdc6b56.tar.zst dexon-sol-tools-b1ecb45f1bf5fed0762e7f17b00f46ae6fdc6b56.zip |
Merge pull request #38 from 0xProject/async-errors
Add a couple of awaits and returns for async tests
-rw-r--r-- | test/exchange_wrapper_test.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 4f3a48b26..b680c015b 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -5,6 +5,7 @@ import * as Web3 from 'web3'; import * as BigNumber from 'bignumber.js'; import * as dirtyChai from 'dirty-chai'; import ChaiBigNumber = require('chai-bignumber'); +import * as chaiAsPromised from 'chai-as-promised'; import promisify = require('es6-promisify'); import {web3Factory} from './utils/web3_factory'; import {ZeroEx} from '../src/0x.js'; @@ -24,6 +25,7 @@ import {TokenUtils} from './utils/token_utils'; chai.config.includeStack = true; chai.use(dirtyChai); chai.use(ChaiBigNumber()); +chai.use(chaiAsPromised); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(); @@ -361,7 +363,7 @@ describe('ExchangeWrapper', () => { describe('#getUnavailableTakerAmountAsync', () => { it ('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - expect(zeroEx.exchange.getUnavailableTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect(zeroEx.exchange.getUnavailableTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); }); it ('should return zero if passed a valid but non-existent orderHash', async () => { const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync(NON_EXISTENT_ORDER_HASH); @@ -376,7 +378,7 @@ describe('ExchangeWrapper', () => { describe('#getFilledTakerAmountAsync', () => { it ('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - expect(zeroEx.exchange.getFilledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect(zeroEx.exchange.getFilledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); }); it ('should return zero if passed a valid but non-existent orderHash', async () => { const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); @@ -391,7 +393,7 @@ describe('ExchangeWrapper', () => { describe('#getCanceledTakerAmountAsync', () => { it ('should throw if passed an invalid orderHash', async () => { const invalidOrderHashHex = '0x123'; - expect(zeroEx.exchange.getCanceledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); + return expect(zeroEx.exchange.getCanceledTakerAmountAsync(invalidOrderHashHex)).to.be.rejected(); }); it ('should return zero if passed a valid but non-existent orderHash', async () => { const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(NON_EXISTENT_ORDER_HASH); @@ -427,7 +429,7 @@ describe('ExchangeWrapper', () => { ); }); afterEach(async () => { - (zeroEx.exchange as any).stopWatchingExchangeLogEventsAsync(); + await (zeroEx.exchange as any).stopWatchingExchangeLogEventsAsync(); }); // Hack: Mocha does not allow a test to be both async and have a `done` callback // Since we need to await the receipt of the event in the `subscribeAsync` callback, |