aboutsummaryrefslogtreecommitdiffstats
path: root/test/order_validation_test.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-10-16 16:40:20 +0800
committerGitHub <noreply@github.com>2017-10-16 16:40:20 +0800
commita798f32cc89b61788856073265d20ad3812576ae (patch)
tree43a7ee4b5dab08091178b09985e180ab8de7f53f /test/order_validation_test.ts
parentc8b54f3bac33f28c315c7018b3185f59e9a474dc (diff)
parentdf5fe4a84f3c5ee8946fa615428c5b9de8f8b06f (diff)
downloaddexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.gz
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.bz2
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.lz
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.xz
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.tar.zst
dexon-sol-tools-a798f32cc89b61788856073265d20ad3812576ae.zip
Merge branch 'development' into setFillOrKillToUseRequestInterface
Diffstat (limited to 'test/order_validation_test.ts')
-rw-r--r--test/order_validation_test.ts38
1 files changed, 36 insertions, 2 deletions
diff --git a/test/order_validation_test.ts b/test/order_validation_test.ts
index 6f9388a69..784fa9ec4 100644
--- a/test/order_validation_test.ts
+++ b/test/order_validation_test.ts
@@ -1,7 +1,6 @@
import * as chai from 'chai';
import * as Web3 from 'web3';
import * as BigNumber from 'bignumber.js';
-import promisify = require('es6-promisify');
import * as Sinon from 'sinon';
import {chaiSetup} from './utils/chai_setup';
import {web3Factory} from './utils/web3_factory';
@@ -35,7 +34,6 @@ describe('OrderValidation', () => {
let orderValidationUtils: OrderValidationUtils;
const fillableAmount = new BigNumber(5);
const fillTakerAmount = new BigNumber(5);
- const shouldThrowOnInsufficientBalanceOrAllowance = false;
before(async () => {
web3 = web3Factory.create();
zeroEx = new ZeroEx(web3.currentProvider);
@@ -257,5 +255,41 @@ describe('OrderValidation', () => {
),
).to.be.true();
});
+ it('should call exchangeTransferSimulator.transferFrom with correct values for an open order', async () => {
+ const makerFee = new BigNumber(2);
+ const takerFee = new BigNumber(2);
+ const signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
+ makerTokenAddress, takerTokenAddress, makerFee, takerFee,
+ makerAddress, ZeroEx.NULL_ADDRESS, fillableAmount, feeRecipient,
+ );
+ await orderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync(
+ exchangeTransferSimulator, signedOrder, fillableAmount, takerAddress, zrxTokenAddress,
+ );
+ expect(transferFromAsync.callCount).to.be.equal(4);
+ expect(
+ transferFromAsync.getCall(0).calledWith(
+ makerTokenAddress, makerAddress, takerAddress, bigNumberMatch(fillableAmount),
+ TradeSide.Maker, TransferType.Trade,
+ ),
+ ).to.be.true();
+ expect(
+ transferFromAsync.getCall(1).calledWith(
+ takerTokenAddress, takerAddress, makerAddress, bigNumberMatch(fillableAmount),
+ TradeSide.Taker, TransferType.Trade,
+ ),
+ ).to.be.true();
+ expect(
+ transferFromAsync.getCall(2).calledWith(
+ zrxTokenAddress, makerAddress, feeRecipient, bigNumberMatch(makerFee),
+ TradeSide.Maker, TransferType.Fee,
+ ),
+ ).to.be.true();
+ expect(
+ transferFromAsync.getCall(3).calledWith(
+ zrxTokenAddress, takerAddress, feeRecipient, bigNumberMatch(takerFee),
+ TradeSide.Taker, TransferType.Fee,
+ ),
+ ).to.be.true();
+ });
});
});