aboutsummaryrefslogtreecommitdiffstats
path: root/test/exchange_wrapper_test.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-10-16 16:40:20 +0800
committerGitHub <noreply@github.com>2017-10-16 16:40:20 +0800
commita798f32cc89b61788856073265d20ad3812576ae (patch)
tree43a7ee4b5dab08091178b09985e180ab8de7f53f /test/exchange_wrapper_test.ts
parentc8b54f3bac33f28c315c7018b3185f59e9a474dc (diff)
parentdf5fe4a84f3c5ee8946fa615428c5b9de8f8b06f (diff)
downloaddexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.gz
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.bz2
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.lz
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.xz
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.zst
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.zip
Merge branch 'development' into setFillOrKillToUseRequestInterface
Diffstat (limited to 'test/exchange_wrapper_test.ts')
-rw-r--r--test/exchange_wrapper_test.ts22
1 files changed, 10 insertions, 12 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index 8c5344b37..f3f16643e 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -3,8 +3,6 @@ import * as chai from 'chai';
import * as Web3 from 'web3';
import * as BigNumber from 'bignumber.js';
import {chaiSetup} from './utils/chai_setup';
-import ChaiBigNumber = require('chai-bignumber');
-import promisify = require('es6-promisify');
import {web3Factory} from './utils/web3_factory';
import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
import {
@@ -16,15 +14,14 @@ import {
ContractEvent,
ExchangeContractErrs,
OrderCancellationRequest,
- LogFillContractEventArgs,
OrderFillRequest,
+ LogFillContractEventArgs,
+ LogCancelContractEventArgs,
LogEvent,
} from '../src';
import {DoneCallback, BlockParamLiteral} from '../src/types';
import {FillScenarios} from './utils/fill_scenarios';
import {TokenUtils} from './utils/token_utils';
-import {assert} from '../src/utils/assert';
-import {TokenTransferProxyWrapper} from '../src/contract_wrappers/token_transfer_proxy_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -650,7 +647,7 @@ describe('ExchangeWrapper', () => {
// Source: https://github.com/mochajs/mocha/issues/2407
it('Should receive the LogFill event when an order is filled', (done: DoneCallback) => {
(async () => {
- const callback = (logEvent: LogEvent) => {
+ const callback = (logEvent: LogEvent<LogFillContractEventArgs>) => {
expect(logEvent.event).to.be.equal(ExchangeEvents.LogFill);
done();
};
@@ -664,7 +661,7 @@ describe('ExchangeWrapper', () => {
});
it('Should receive the LogCancel event when an order is cancelled', (done: DoneCallback) => {
(async () => {
- const callback = (logEvent: LogEvent) => {
+ const callback = (logEvent: LogEvent<LogCancelContractEventArgs>) => {
expect(logEvent.event).to.be.equal(ExchangeEvents.LogCancel);
done();
};
@@ -676,7 +673,7 @@ describe('ExchangeWrapper', () => {
});
it('Outstanding subscriptions are cancelled when zeroEx.setProviderAsync called', (done: DoneCallback) => {
(async () => {
- const callbackNeverToBeCalled = (logEvent: LogEvent) => {
+ const callbackNeverToBeCalled = (logEvent: LogEvent<LogFillContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
};
await zeroEx.exchange.subscribeAsync(
@@ -686,7 +683,7 @@ describe('ExchangeWrapper', () => {
const newProvider = web3Factory.getRpcProvider();
await zeroEx.setProviderAsync(newProvider);
- const callback = (logEvent: LogEvent) => {
+ const callback = (logEvent: LogEvent<LogFillContractEventArgs>) => {
expect(logEvent.event).to.be.equal(ExchangeEvents.LogFill);
done();
};
@@ -700,7 +697,7 @@ describe('ExchangeWrapper', () => {
});
it('Should cancel subscription when unsubscribe called', (done: DoneCallback) => {
(async () => {
- const callbackNeverToBeCalled = (logEvent: LogEvent) => {
+ const callbackNeverToBeCalled = (logEvent: LogEvent<LogFillContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
};
const subscriptionToken = await zeroEx.exchange.subscribeAsync(
@@ -810,11 +807,12 @@ describe('ExchangeWrapper', () => {
const indexFilterValues = {
maker: differentMakerAddress,
};
- const logs = await zeroEx.exchange.getLogsAsync(
+ const logs = await zeroEx.exchange.getLogsAsync<LogFillContractEventArgs>(
eventName, subscriptionOpts, indexFilterValues,
);
expect(logs).to.have.length(1);
- expect(logs[0].args.maker).to.be.equal(differentMakerAddress);
+ const args = logs[0].args;
+ expect(args.maker).to.be.equal(differentMakerAddress);
});
});
});