From bdbd01f965d76f5f3a5524d5d688eac14427a875 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 17 Jul 2017 14:40:38 -0700 Subject: Add a test: should throw when maker has balance to cover fees or transfer but not both --- test/exchange_wrapper_test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts index 0dc67bb01..813afdddd 100644 --- a/test/exchange_wrapper_test.ts +++ b/test/exchange_wrapper_test.ts @@ -303,6 +303,21 @@ describe('ExchangeWrapper', () => { )).to.be.rejectedWith(ExchangeContractErrs.InsufficientTakerFeeAllowance); }); }); + it('should throw when maker has balance to cover fees or transfer but not both', async () => { + const makerFee = new BigNumber(1); + const takerFee = new BigNumber(1); + const signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync( + zrxTokenAddress, takerTokenAddress, makerFee, takerFee, + makerAddress, takerAddress, fillableAmount, feeRecipient, + ); + const balanceToSubtractFromMaker = new BigNumber(1); + await zeroEx.token.transferAsync( + zrxTokenAddress, makerAddress, coinbase, balanceToSubtractFromMaker, + ); + return expect( + zeroEx.exchange.fillOrderAsync(signedOrder, fillTakerAmount, shouldCheckTransfer, takerAddress), + ).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerBalance); + }); }); describe('successful fills', () => { it('should fill a valid order', async () => { -- cgit v1.2.3