From 592cab8d3f487450943d5f6e31815939f581bb96 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 5 Jun 2017 14:12:20 +0200 Subject: Add a couple of awaits and returns for async tests --- test/exchange_wrapper_test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/exchange_wrapper_test.ts') diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 4f3a48b26..c4e6e308b 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -361,7 +361,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 +376,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 +391,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 +427,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, -- cgit v1.2.3 From 713ad291c4d4c537ef142e332566555076708b6d Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 5 Jun 2017 15:31:39 +0200 Subject: Add chai-as-promised --- test/exchange_wrapper_test.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/exchange_wrapper_test.ts') diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index c4e6e308b..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(); -- cgit v1.2.3