aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-10-10 16:58:18 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-10-10 16:58:18 +0800
commitbda979a6c7e825446adce2d6d3b4800b5012a08d (patch)
tree77a413fe5b26e1993e890a19c15830b2e8103615
parentcfae1a8dfd12fb44ae9b5c9d180ac272f3ce408a (diff)
downloaddexon-sol-tools-bda979a6c7e825446adce2d6d3b4800b5012a08d.tar
dexon-sol-tools-bda979a6c7e825446adce2d6d3b4800b5012a08d.tar.gz
dexon-sol-tools-bda979a6c7e825446adce2d6d3b4800b5012a08d.tar.bz2
dexon-sol-tools-bda979a6c7e825446adce2d6d3b4800b5012a08d.tar.lz
dexon-sol-tools-bda979a6c7e825446adce2d6d3b4800b5012a08d.tar.xz
dexon-sol-tools-bda979a6c7e825446adce2d6d3b4800b5012a08d.tar.zst
dexon-sol-tools-bda979a6c7e825446adce2d6d3b4800b5012a08d.zip
Change tests to test that allowance is checked first
-rw-r--r--test/exchange_transfer_simulator_test.ts14
1 files 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);