diff options
author | Fabio Berger <me@fabioberger.com> | 2017-06-02 18:15:57 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-06-02 18:15:57 +0800 |
commit | 9d9b6f7cc0b71874f73c0f7c1d55f5010fe0609f (patch) | |
tree | 969c1051d01697a2726efec4915881231660cdb3 /test | |
parent | fc7592d73f1613b11e4b48904bfb041cccca5800 (diff) | |
parent | 4caf1b009ea253d08e1cd6ecc4e914606e2d31c1 (diff) | |
download | dexon-sol-tools-9d9b6f7cc0b71874f73c0f7c1d55f5010fe0609f.tar dexon-sol-tools-9d9b6f7cc0b71874f73c0f7c1d55f5010fe0609f.tar.gz dexon-sol-tools-9d9b6f7cc0b71874f73c0f7c1d55f5010fe0609f.tar.bz2 dexon-sol-tools-9d9b6f7cc0b71874f73c0f7c1d55f5010fe0609f.tar.lz dexon-sol-tools-9d9b6f7cc0b71874f73c0f7c1d55f5010fe0609f.tar.xz dexon-sol-tools-9d9b6f7cc0b71874f73c0f7c1d55f5010fe0609f.tar.zst dexon-sol-tools-9d9b6f7cc0b71874f73c0f7c1d55f5010fe0609f.zip |
Merge branch 'fillOrderAsync' of github.com:0xProject/0x.js into fillOrderAsync
Diffstat (limited to 'test')
-rw-r--r-- | test/exchange_wrapper_test.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 8d39c9e57..0c1f552b6 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -207,6 +207,23 @@ describe('ExchangeWrapper', () => { expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, takerAddress)) .to.be.bignumber.equal(fillableAmount.minus(fillTakerAmountInBaseUnits)); }); + it('should partially fill the valid order', async () => { + const fillableAmount = new BigNumber(5); + const signedOrder = await fillScenarios.createAFillableSignedOrderAsync( + makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount, + ); + const partialFillAmount = new BigNumber(3); + zeroEx.setTransactionSenderAccount(takerAddress); + await zeroEx.exchange.fillOrderAsync(signedOrder, partialFillAmount, shouldCheckTransfer); + expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, makerAddress)) + .to.be.bignumber.equal(fillableAmount.minus(partialFillAmount)); + expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, makerAddress)) + .to.be.bignumber.equal(partialFillAmount); + expect(await zeroEx.token.getBalanceAsync(makerTokenAddress, takerAddress)) + .to.be.bignumber.equal(partialFillAmount); + expect(await zeroEx.token.getBalanceAsync(takerTokenAddress, takerAddress)) + .to.be.bignumber.equal(fillableAmount.minus(partialFillAmount)); + }); }); }); }); |