diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-10 00:54:12 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-10 00:54:12 +0800 |
commit | 5d2843ef6f73787c3fdfe1324d121a15c618ef64 (patch) | |
tree | 3665dd9fb34eeadf09d58fa33ca2fa9883218a15 /test | |
parent | af36ceb0b8f2d8c734b15158e69ba7bfb5fdc5a4 (diff) | |
download | dexon-0x-contracts-5d2843ef6f73787c3fdfe1324d121a15c618ef64.tar.gz dexon-0x-contracts-5d2843ef6f73787c3fdfe1324d121a15c618ef64.tar.zst dexon-0x-contracts-5d2843ef6f73787c3fdfe1324d121a15c618ef64.zip |
Add test for zeroEx.exchange.getCanceledTakerAmountAsync
Diffstat (limited to 'test')
-rw-r--r-- | test/exchange_wrapper_test.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index f159de759..6a511e68d 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -531,6 +531,7 @@ describe('ExchangeWrapper', () => { let fillableAmount: BigNumber.BigNumber; let partialFillAmount: BigNumber.BigNumber; let signedOrder: SignedOrder; + let orderHash: string; before(() => { takerAddress = userAddresses[1]; const [makerToken, takerToken] = tokens; @@ -543,6 +544,7 @@ describe('ExchangeWrapper', () => { signedOrder = await fillScenarios.createPartiallyFilledSignedOrderAsync( makerTokenAddress, takerTokenAddress, takerAddress, fillableAmount, partialFillAmount, ); + orderHash = await zeroEx.getOrderHashHexAsync(signedOrder); }); describe('#getUnavailableTakerAmountAsync', () => { it ('should throw if passed an invalid orderHash', async () => { @@ -554,7 +556,6 @@ describe('ExchangeWrapper', () => { expect(unavailableValueT).to.be.bignumber.equal(0); }); it ('should return the unavailableValueT for a valid and partially filled orderHash', async () => { - const orderHash = await zeroEx.getOrderHashHexAsync(signedOrder); const unavailableValueT = await zeroEx.exchange.getUnavailableTakerAmountAsync(orderHash); expect(unavailableValueT).to.be.bignumber.equal(partialFillAmount); }); @@ -569,7 +570,6 @@ describe('ExchangeWrapper', () => { expect(filledValueT).to.be.bignumber.equal(0); }); it ('should return the filledValueT for a valid and partially filled orderHash', async () => { - const orderHash = await zeroEx.getOrderHashHexAsync(signedOrder); const filledValueT = await zeroEx.exchange.getFilledTakerAmountAsync(orderHash); expect(filledValueT).to.be.bignumber.equal(partialFillAmount); }); @@ -584,10 +584,15 @@ describe('ExchangeWrapper', () => { expect(cancelledValueT).to.be.bignumber.equal(0); }); it ('should return the cancelledValueT for a valid and partially filled orderHash', async () => { - const orderHash = await zeroEx.getOrderHashHexAsync(signedOrder); const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash); expect(cancelledValueT).to.be.bignumber.equal(0); }); + it ('should return the cancelledValueT for a valid and cancelled orderHash', async () => { + const cancelAmount = fillableAmount.minus(partialFillAmount); + await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmount); + const cancelledValueT = await zeroEx.exchange.getCanceledTakerAmountAsync(orderHash); + expect(cancelledValueT).to.be.bignumber.equal(cancelAmount); + }); }); }); describe('#subscribeAsync', () => { |