aboutsummaryrefslogtreecommitdiffstats
path: root/test/exchange_wrapper_test.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-08 01:11:21 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-08 01:11:21 +0800
commitedbbf5a215209bcb67052ca6cb83bb40e149d9a7 (patch)
treea67217f7f1c60eb7a745308c97fda2edc69b7733 /test/exchange_wrapper_test.ts
parentf3d9f554d9916af48038ae810d75aaf3f78676c9 (diff)
downloaddexon-sol-tools-edbbf5a215209bcb67052ca6cb83bb40e149d9a7.tar
dexon-sol-tools-edbbf5a215209bcb67052ca6cb83bb40e149d9a7.tar.gz
dexon-sol-tools-edbbf5a215209bcb67052ca6cb83bb40e149d9a7.tar.bz2
dexon-sol-tools-edbbf5a215209bcb67052ca6cb83bb40e149d9a7.tar.lz
dexon-sol-tools-edbbf5a215209bcb67052ca6cb83bb40e149d9a7.tar.xz
dexon-sol-tools-edbbf5a215209bcb67052ca6cb83bb40e149d9a7.tar.zst
dexon-sol-tools-edbbf5a215209bcb67052ca6cb83bb40e149d9a7.zip
Add success test
Diffstat (limited to 'test/exchange_wrapper_test.ts')
-rw-r--r--test/exchange_wrapper_test.ts30
1 files changed, 27 insertions, 3 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index b0aa351a4..748816949 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -16,7 +16,9 @@ import {
ExchangeEvents,
ContractEvent,
DoneCallback,
- ExchangeContractErrs, OrderCancellationRequest,
+ ExchangeContractErrs,
+ OrderCancellationRequest,
+ OrderFillRequest,
} from '../src/types';
import {FillScenarios} from './utils/fill_scenarios';
import {TokenUtils} from './utils/token_utils';
@@ -132,7 +134,6 @@ describe('ExchangeWrapper', () => {
const shouldCheckTransfer = false;
before(async () => {
[coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses;
- tokens = await zeroEx.tokenRegistry.getTokensAsync();
const [makerToken, takerToken] = tokenUtils.getNonProtocolTokens();
makerTokenAddress = makerToken.address;
takerTokenAddress = takerToken.address;
@@ -322,19 +323,42 @@ describe('ExchangeWrapper', () => {
});
});
describe('#batchFillOrderAsync', () => {
+ let signedOrder: SignedOrder;
+ let signedOrderHashHex: string;
let anotherSignedOrder: SignedOrder;
let anotherOrderHashHex: string;
+ let orderFillBatch: OrderFillRequest[];
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);
+ orderFillBatch = [
+ {
+ signedOrder,
+ takerTokenFillAmount: fillTakerAmount,
+ },
+ {
+ signedOrder: anotherSignedOrder,
+ takerTokenFillAmount: fillTakerAmount,
+ },
+ ];
});
describe('failed batch fills', () => {
});
describe('successful batch fills', () => {
-
+ it('should successfully fill multiple orders', async () => {
+ await zeroEx.exchange.batchFillOrderAsync(orderFillBatch, shouldCheckTransfer, takerAddress);
+ const filledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(signedOrderHashHex);
+ const anotherFilledAmount = await zeroEx.exchange.getFilledTakerAmountAsync(anotherOrderHashHex);
+ expect(filledAmount).to.be.bignumber.equal(fillTakerAmount);
+ expect(anotherFilledAmount).to.be.bignumber.equal(fillTakerAmount);
+ });
});
});
});