aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-06-09 23:06:40 +0800
committerGitHub <noreply@github.com>2017-06-09 23:06:40 +0800
commit48a2ce35fe77b4d1e9c9610a4f4bf2f5c9829ef1 (patch)
tree8c516c1d33d77af980fd931739a0870b05ae262c /test
parent9ffd36d57f2926629f8ca7e48ede87b2a6929ff9 (diff)
parent3a9d07c40ce2e26203962487036132d6357ec530 (diff)
downloaddexon-sol-tools-48a2ce35fe77b4d1e9c9610a4f4bf2f5c9829ef1.tar
dexon-sol-tools-48a2ce35fe77b4d1e9c9610a4f4bf2f5c9829ef1.tar.gz
dexon-sol-tools-48a2ce35fe77b4d1e9c9610a4f4bf2f5c9829ef1.tar.bz2
dexon-sol-tools-48a2ce35fe77b4d1e9c9610a4f4bf2f5c9829ef1.tar.lz
dexon-sol-tools-48a2ce35fe77b4d1e9c9610a4f4bf2f5c9829ef1.tar.xz
dexon-sol-tools-48a2ce35fe77b4d1e9c9610a4f4bf2f5c9829ef1.tar.zst
dexon-sol-tools-48a2ce35fe77b4d1e9c9610a4f4bf2f5c9829ef1.zip
Merge branch 'master' into async-bug
Diffstat (limited to 'test')
-rw-r--r--test/exchange_wrapper_test.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index 2cd8af7f0..f159de759 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -392,6 +392,40 @@ describe('ExchangeWrapper', () => {
});
});
});
+ describe('#fillOrdersUpTo', () => {
+ let signedOrder: SignedOrder;
+ let signedOrderHashHex: string;
+ let anotherSignedOrder: SignedOrder;
+ let anotherOrderHashHex: string;
+ let signedOrders: SignedOrder[];
+ const fillUpToAmount = fillableAmount.plus(fillableAmount).minus(1);
+ beforeEach(async () => {
+ signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount,
+ );
+ signedOrderHashHex = await zeroEx.getOrderHashHexAsync(signedOrder);
+ anotherSignedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, fillableAmount,
+ );
+ anotherOrderHashHex = await zeroEx.getOrderHashHexAsync(anotherSignedOrder);
+ signedOrders = [signedOrder, anotherSignedOrder];
+ });
+ describe('successful batch fills', () => {
+ it('should no-op for an empty batch', async () => {
+ await zeroEx.exchange.fillOrdersUpToAsync([], fillUpToAmount, shouldCheckTransfer, takerAddress);
+ });
+ it('should successfully fill up to specified amount', async () => {
+ await zeroEx.exchange.fillOrdersUpToAsync(
+ signedOrders, fillUpToAmount, shouldCheckTransfer, takerAddress,
+ );
+ const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex);
+ const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex);
+ expect(filledAmount).to.be.bignumber.equal(fillableAmount);
+ const remainingFillAmount = fillableAmount.minus(1);
+ expect(anotherFilledAmount).to.be.bignumber.equal(remainingFillAmount);
+ });
+ });
+ });
});
describe('cancel order(s)', () => {
let makerTokenAddress: string;