aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-07-18 05:40:38 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-07-26 04:25:56 +0800
commitbdbd01f965d76f5f3a5524d5d688eac14427a875 (patch)
treec6e6dc3741e50a3dd82a76338f58c15810f09d9e
parent97e680aba1a68c509e903e929a848db53182722f (diff)
downloaddexon-sol-tools-bdbd01f965d76f5f3a5524d5d688eac14427a875.tar
dexon-sol-tools-bdbd01f965d76f5f3a5524d5d688eac14427a875.tar.gz
dexon-sol-tools-bdbd01f965d76f5f3a5524d5d688eac14427a875.tar.bz2
dexon-sol-tools-bdbd01f965d76f5f3a5524d5d688eac14427a875.tar.lz
dexon-sol-tools-bdbd01f965d76f5f3a5524d5d688eac14427a875.tar.xz
dexon-sol-tools-bdbd01f965d76f5f3a5524d5d688eac14427a875.tar.zst
dexon-sol-tools-bdbd01f965d76f5f3a5524d5d688eac14427a875.zip
Add a test: should throw when maker has balance to cover fees or transfer but not both
-rw-r--r--test/exchange_wrapper_test.ts15
1 files changed, 15 insertions, 0 deletions
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 () => {