diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/exchange_wrapper_test.ts | 22 |
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); }); }); }); |