aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-09 23:49:50 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-09 23:49:50 +0800
commitb63c973d14feeac851f3b2a41bdce027af6d3b7f (patch)
treecf6b3e5636168eb3f5fbf7ea3be534248d68f19e
parent3a9d07c40ce2e26203962487036132d6357ec530 (diff)
downloaddexon-sol-tools-b63c973d14feeac851f3b2a41bdce027af6d3b7f.tar
dexon-sol-tools-b63c973d14feeac851f3b2a41bdce027af6d3b7f.tar.gz
dexon-sol-tools-b63c973d14feeac851f3b2a41bdce027af6d3b7f.tar.bz2
dexon-sol-tools-b63c973d14feeac851f3b2a41bdce027af6d3b7f.tar.lz
dexon-sol-tools-b63c973d14feeac851f3b2a41bdce027af6d3b7f.tar.xz
dexon-sol-tools-b63c973d14feeac851f3b2a41bdce027af6d3b7f.tar.zst
dexon-sol-tools-b63c973d14feeac851f3b2a41bdce027af6d3b7f.zip
Add LogCancel test to subscribeAsync
-rw-r--r--test/exchange_wrapper_test.ts20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index f159de759..0e3a5264b 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -626,18 +626,34 @@ describe('ExchangeWrapper', () => {
fromBlock: 0,
toBlock: 'latest',
};
+ const fillTakerAmountInBaseUnits = new BigNumber(1);
await zeroEx.exchange.subscribeAsync(ExchangeEvents.LogFill, subscriptionOpts,
indexFilterValues, (err: Error, event: ContractEvent) => {
expect(err).to.be.null();
- expect(event).to.not.be.undefined();
+ expect(event.args.filledValueT).to.be.bignumber.equal(fillTakerAmountInBaseUnits);
done();
});
- const fillTakerAmountInBaseUnits = new BigNumber(1);
await zeroEx.exchange.fillOrderAsync(
signedOrder, fillTakerAmountInBaseUnits, shouldCheckTransfer, takerAddress,
);
})();
});
+ it.only('Should receive the LogCancel event when an order is cancelled', (done: DoneCallback) => {
+ (async () => {
+ const subscriptionOpts: SubscriptionOpts = {
+ fromBlock: 0,
+ toBlock: 'latest',
+ };
+ const cancelTakerAmountInBaseUnits = new BigNumber(1);
+ await zeroEx.exchange.subscribeAsync(ExchangeEvents.LogCancel, subscriptionOpts,
+ indexFilterValues, (err: Error, event: ContractEvent) => {
+ expect(err).to.be.null();
+ expect(event.args.cancelledValueT).to.be.bignumber.equal(cancelTakerAmountInBaseUnits);
+ done();
+ });
+ await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelTakerAmountInBaseUnits);
+ })();
+ });
it('Outstanding subscriptions are cancelled when zeroEx.setProviderAsync called', (done: DoneCallback) => {
(async () => {
const subscriptionOpts: SubscriptionOpts = {