From bda979a6c7e825446adce2d6d3b4800b5012a08d Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 10 Oct 2017 11:58:18 +0300 Subject: Change tests to test that allowance is checked first --- test/exchange_transfer_simulator_test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/exchange_transfer_simulator_test.ts b/test/exchange_transfer_simulator_test.ts index 0331699c8..6ad2c007c 100644 --- a/test/exchange_transfer_simulator_test.ts +++ b/test/exchange_transfer_simulator_test.ts @@ -41,18 +41,18 @@ describe('ExchangeTransferSimulator', () => { beforeEach(() => { exchangeTransferSimulator = new ExchangeTransferSimulator(zeroEx.token); }); - it('throws if the user doesn\'t have enough balance', async () => { - return expect(exchangeTransferSimulator.transferFromAsync( - exampleTokenAddress, sender, recipient, transferAmount, TradeSide.Maker, TransferType.Trade, - )).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerBalance); - }); it('throws if the user doesn\'t have enough allowance', async () => { - txHash = await zeroEx.token.transferAsync(exampleTokenAddress, coinbase, sender, transferAmount); - await zeroEx.awaitTransactionMinedAsync(txHash); return expect(exchangeTransferSimulator.transferFromAsync( exampleTokenAddress, sender, recipient, transferAmount, TradeSide.Taker, TransferType.Trade, )).to.be.rejectedWith(ExchangeContractErrs.InsufficientTakerAllowance); }); + it('throws if the user doesn\'t have enough balance', async () => { + txHash = await zeroEx.token.setProxyAllowanceAsync(exampleTokenAddress, sender, transferAmount); + await zeroEx.awaitTransactionMinedAsync(txHash); + return expect(exchangeTransferSimulator.transferFromAsync( + exampleTokenAddress, sender, recipient, transferAmount, TradeSide.Maker, TransferType.Trade, + )).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerBalance); + }); it('updates balances and proxyAllowance after transfer', async () => { txHash = await zeroEx.token.transferAsync(exampleTokenAddress, coinbase, sender, transferAmount); await zeroEx.awaitTransactionMinedAsync(txHash); -- cgit