aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-02 18:08:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-02 18:08:25 +0800
commit4caf1b009ea253d08e1cd6ecc4e914606e2d31c1 (patch)
treea6203c1582ddbe39a1e59290e9c1c56753f271e3
parent5155f4980440f1c91006b124406c8b4a7a90e300 (diff)
downloaddexon-sol-tools-4caf1b009ea253d08e1cd6ecc4e914606e2d31c1.tar
dexon-sol-tools-4caf1b009ea253d08e1cd6ecc4e914606e2d31c1.tar.gz
dexon-sol-tools-4caf1b009ea253d08e1cd6ecc4e914606e2d31c1.tar.bz2
dexon-sol-tools-4caf1b009ea253d08e1cd6ecc4e914606e2d31c1.tar.lz
dexon-sol-tools-4caf1b009ea253d08e1cd6ecc4e914606e2d31c1.tar.xz
dexon-sol-tools-4caf1b009ea253d08e1cd6ecc4e914606e2d31c1.tar.zst
dexon-sol-tools-4caf1b009ea253d08e1cd6ecc4e914606e2d31c1.zip
Add test for valid partial fill
-rw-r--r--test/exchange_wrapper_test.ts17
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));
+ });
});
});
});