aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-01 20:59:26 +0800
committerFabio Berger <me@fabioberger.com>2017-06-01 20:59:26 +0800
commit085e4fb8962d2d79d60270967aef0f55acb788bf (patch)
treeeb244736bebb520316eb0a63cf48a5c92b98bb61
parent1668a085049d3b065c47709ef0018a66f637b992 (diff)
parent75d0b69db294a58b8fdca330d4724ecf758d65f2 (diff)
downloaddexon-sol-tools-085e4fb8962d2d79d60270967aef0f55acb788bf.tar
dexon-sol-tools-085e4fb8962d2d79d60270967aef0f55acb788bf.tar.gz
dexon-sol-tools-085e4fb8962d2d79d60270967aef0f55acb788bf.tar.bz2
dexon-sol-tools-085e4fb8962d2d79d60270967aef0f55acb788bf.tar.lz
dexon-sol-tools-085e4fb8962d2d79d60270967aef0f55acb788bf.tar.xz
dexon-sol-tools-085e4fb8962d2d79d60270967aef0f55acb788bf.tar.zst
dexon-sol-tools-085e4fb8962d2d79d60270967aef0f55acb788bf.zip
Merge branch 'fillOrderAsync' of github.com:0xProject/0x.js into fillOrderAsync
-rw-r--r--test/exchange_wrapper_test.ts13
-rw-r--r--test/utils/order_factory.ts (renamed from test/utils/order.ts)3
2 files changed, 7 insertions, 9 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index ca040ab28..b2fb1894b 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -6,7 +6,7 @@ import promisify = require('es6-promisify');
import * as _ from 'lodash';
import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
import * as BigNumber from 'bignumber.js';
-import {orderFactory} from './utils/order';
+import {orderFactory} from './utils/order_factory';
import {Token} from '../src/types';
import * as Web3 from 'web3';
import * as dirtyChai from 'dirty-chai';
@@ -128,7 +128,9 @@ describe('ExchangeWrapper', () => {
});
describe('failed fills', () => {
it('should throw when the fill amount is zero', async () => {
- const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, userAddresses[0],
+ const maker = userAddresses[0];
+ const taker = userAddresses[1];
+ const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker,
5, addressBySymbol.MLN, 5, addressBySymbol.GNT);
const fillAmount = new BigNumber(0);
expect(zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount))
@@ -145,14 +147,9 @@ describe('ExchangeWrapper', () => {
await setAllowance(maker, 5, addressBySymbol.MLN);
await setBalance(taker, 5, addressBySymbol.GNT);
await setAllowance(taker, 5, addressBySymbol.GNT);
- const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker,
+ const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker,
5, addressBySymbol.MLN, 5, addressBySymbol.GNT);
const fillAmount = new BigNumber(5);
- expect(await zeroEx.token.getBalanceAsync(addressBySymbol.MLN, maker)).to.be.bignumber.greaterThan(5);
- expect(await zeroEx.token.getBalanceAsync(addressBySymbol.MLN, taker)).to.be.bignumber.equal(0);
- expect(await zeroEx.token.getBalanceAsync(addressBySymbol.GNT, taker)).to.be.bignumber.equal(5);
- expect(await zeroEx.token.getProxyAllowanceAsync(addressBySymbol.MLN, maker)).to.be.bignumber.equal(5);
- expect(await zeroEx.token.getProxyAllowanceAsync(addressBySymbol.GNT, taker)).to.be.bignumber.equal(5);
zeroEx.setDefaultAccount(taker);
await zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount);
expect(await zeroEx.token.getBalanceAsync(addressBySymbol.MLN, taker)).to.be.bignumber.equal(5);
diff --git a/test/utils/order.ts b/test/utils/order_factory.ts
index 8a7d8430e..e41e973ee 100644
--- a/test/utils/order.ts
+++ b/test/utils/order_factory.ts
@@ -10,6 +10,7 @@ export const orderFactory = {
zeroEx: ZeroEx,
networkId: number,
maker: string,
+ taker: string,
makerTokenAmount: BigNumber.BigNumber|number,
makerTokenAddress: string,
takerTokenAmount: BigNumber.BigNumber|number,
@@ -19,7 +20,7 @@ export const orderFactory = {
const INF_TIMESTAMP = 2524604400;
const order = {
maker,
- taker: undefined,
+ taker,
makerFee: new BigNumber(0),
takerFee: new BigNumber(0),
makerTokenAmount: _.isNumber(makerTokenAmount) ? new BigNumber(makerTokenAmount) : makerTokenAmount,