From b63c973d14feeac851f3b2a41bdce027af6d3b7f Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Jun 2017 17:49:50 +0200 Subject: Add LogCancel test to subscribeAsync --- test/exchange_wrapper_test.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'test') 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 = { -- cgit v1.2.3 From 2fd5d29b40827f84f9fb078eea984e8d9a36e88b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Jun 2017 17:57:51 +0200 Subject: Remove only --- test/exchange_wrapper_test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 0e3a5264b..f5ed1304b 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -638,7 +638,7 @@ describe('ExchangeWrapper', () => { ); })(); }); - it.only('Should receive the LogCancel event when an order is cancelled', (done: DoneCallback) => { + it('Should receive the LogCancel event when an order is cancelled', (done: DoneCallback) => { (async () => { const subscriptionOpts: SubscriptionOpts = { fromBlock: 0, -- cgit v1.2.3 From 800788eca4299f69930a0030b2a0e0e7eaadcace Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Jun 2017 18:12:45 +0200 Subject: Fix tests --- test/exchange_wrapper_test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index f5ed1304b..3ee8ff188 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -626,13 +626,13 @@ 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.args.filledValueT).to.be.bignumber.equal(fillTakerAmountInBaseUnits); + expect(event).to.not.be.undefined(); done(); }); + const fillTakerAmountInBaseUnits = new BigNumber(1); await zeroEx.exchange.fillOrderAsync( signedOrder, fillTakerAmountInBaseUnits, shouldCheckTransfer, takerAddress, ); @@ -644,13 +644,13 @@ describe('ExchangeWrapper', () => { 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); + expect(event).to.not.be.undefined(); done(); }); + const cancelTakerAmountInBaseUnits = new BigNumber(1); await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelTakerAmountInBaseUnits); })(); }); -- cgit v1.2.3