aboutsummaryrefslogtreecommitdiffstats
path: root/test/exchange_wrapper_test.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-06-01 23:25:33 +0800
committerFabio Berger <me@fabioberger.com>2017-06-01 23:25:33 +0800
commit1e8eb054bc99baf9d10cafe9d5d388857484a801 (patch)
tree4033b0e3c97fec5f2c44d31e9c3c4b49f1d753a8 /test/exchange_wrapper_test.ts
parent3e76497f4e47cb897b1afde509c3d2eb424a4f84 (diff)
downloaddexon-sol-tools-1e8eb054bc99baf9d10cafe9d5d388857484a801.tar
dexon-sol-tools-1e8eb054bc99baf9d10cafe9d5d388857484a801.tar.gz
dexon-sol-tools-1e8eb054bc99baf9d10cafe9d5d388857484a801.tar.bz2
dexon-sol-tools-1e8eb054bc99baf9d10cafe9d5d388857484a801.tar.lz
dexon-sol-tools-1e8eb054bc99baf9d10cafe9d5d388857484a801.tar.xz
dexon-sol-tools-1e8eb054bc99baf9d10cafe9d5d388857484a801.tar.zst
dexon-sol-tools-1e8eb054bc99baf9d10cafe9d5d388857484a801.zip
get rid of literal amount params
Diffstat (limited to 'test/exchange_wrapper_test.ts')
-rw-r--r--test/exchange_wrapper_test.ts22
1 files changed, 16 insertions, 6 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index 9a519e92e..cb7482c99 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -141,23 +141,29 @@ describe('ExchangeWrapper', () => {
});
describe('failed fills', () => {
it('should throw when the fill amount is zero', async () => {
+ const makerAmount = 5;
+ const takerAmount = 5;
const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker,
- 5, addressBySymbol.MLN, 5, addressBySymbol.GNT);
+ makerAmount, addressBySymbol.MLN, takerAmount, addressBySymbol.GNT);
const zeroFillAmount = new BigNumber(0);
zeroEx.setDefaultAccount(taker);
expect(zeroEx.exchange.fillOrderAsync(signedOrder, zeroFillAmount, shouldCheckTransfer))
.to.be.rejectedWith(FillOrderValidationErrs.FILL_AMOUNT_IS_ZERO);
});
it('should throw when sender is not a taker', async () => {
+ const makerAmount = 5;
+ const takerAmount = 5;
const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker,
- 5, addressBySymbol.MLN, 5, addressBySymbol.GNT);
+ makerAmount, addressBySymbol.MLN, takerAmount, addressBySymbol.GNT);
expect(zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount, shouldCheckTransfer))
.to.be.rejectedWith(FillOrderValidationErrs.NOT_A_TAKER);
});
it('should throw when order is expired', async () => {
const OLD_TIMESTAMP = new BigNumber(42);
+ const makerAmount = 5;
+ const takerAmount = 5;
const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker,
- 5, addressBySymbol.MLN, 5, addressBySymbol.GNT, OLD_TIMESTAMP);
+ makerAmount, addressBySymbol.MLN, takerAmount, addressBySymbol.GNT, OLD_TIMESTAMP);
zeroEx.setDefaultAccount(taker);
expect(zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount, shouldCheckTransfer))
.to.be.rejectedWith(FillOrderValidationErrs.EXPIRED);
@@ -165,12 +171,16 @@ describe('ExchangeWrapper', () => {
});
describe('successful fills', () => {
it('should fill the valid order', async () => {
+ const makerAmount = 5;
+ const takerAmount = 5;
const signedOrder = await orderFactory.createSignedOrderAsync(zeroEx, networkId, maker, taker,
- 5, addressBySymbol.MLN, 5, addressBySymbol.GNT);
+ makerAmount, addressBySymbol.MLN, takerAmount, addressBySymbol.GNT);
zeroEx.setDefaultAccount(taker);
await zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount, shouldCheckTransfer);
- expect(await zeroEx.token.getBalanceAsync(addressBySymbol.MLN, taker)).to.be.bignumber.equal(5);
- expect(await zeroEx.token.getBalanceAsync(addressBySymbol.GNT, taker)).to.be.bignumber.equal(0);
+ expect(await zeroEx.token.getBalanceAsync(addressBySymbol.MLN, taker))
+ .to.be.bignumber.equal(fillAmount);
+ expect(await zeroEx.token.getBalanceAsync(addressBySymbol.GNT, taker))
+ .to.be.bignumber.equal(0);
});
});
});