diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-21 23:48:03 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-21 23:55:21 +0800 |
commit | 42c61ecda5c29018b5984fb377eb9a3ba5cb1c86 (patch) | |
tree | 4c4a4da164839164092320e070e6f455796ff01b /test | |
parent | 656d74518d0d634febcb9e7f5540e85729530843 (diff) | |
download | dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.gz dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.bz2 dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.lz dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.xz dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.tar.zst dexon-sol-tools-42c61ecda5c29018b5984fb377eb9a3ba5cb1c86.zip |
Return filledAmount from fillOrderAsync
Diffstat (limited to 'test')
-rw-r--r-- | test/exchange_wrapper_test.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index e4b2e3f86..6425e308a 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -339,6 +339,24 @@ describe('ExchangeWrapper', () => { expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, takerAddress)) .to.be.bignumber.equal(fillableAmount.minus(partialFillAmount)); }); + it('should return filled amount', async () => { + const signedOrder = await fillScenarios.createFillableSignedOrderAsync( + makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, + ); + const partialFillAmount = new BigNumber(3); + await zeroEx.exchange.fillOrderAsync( + signedOrder, partialFillAmount, shouldCheckTransfer, takerAddress); + const missingBalance = new BigNumber(1); + const totalBalance = partialFillAmount.plus(missingBalance); + await zeroEx.token.transferAsync(takerTokenAddress, coinbase, takerAddress, missingBalance); + await zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, totalBalance); + await zeroEx.token.transferAsync(makerTokenAddress, coinbase, makerAddress, missingBalance); + await zeroEx.token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, totalBalance); + const remainingFillAmount = fillableAmount.minus(partialFillAmount); + const filledAmount = await zeroEx.exchange.fillOrderAsync( + signedOrder, partialFillAmount, shouldCheckTransfer, takerAddress); + expect(filledAmount).to.be.bignumber.equal(remainingFillAmount); + }); it('should fill the valid orders with fees', async () => { const makerFee = new BigNumber(1); const takerFee = new BigNumber(2); |