diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-06 07:20:38 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-07 03:40:31 +0800 |
commit | d6d7f4e875b161aa7284467a61f67989f76ec89e (patch) | |
tree | d0287504809489cec96a9673ffac41429cf14cd7 /packages/contracts/test/unlimited_allowance_token.ts | |
parent | 63caddea62453863de84a4b53e14fe3e61d3008f (diff) | |
download | dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.gz dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.bz2 dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.lz dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.xz dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.tar.zst dexon-0x-contracts-d6d7f4e875b161aa7284467a61f67989f76ec89e.zip |
Update more things to work with both Geth and Ganache
Diffstat (limited to 'packages/contracts/test/unlimited_allowance_token.ts')
-rw-r--r-- | packages/contracts/test/unlimited_allowance_token.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index ea20df040..a66d0055b 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -7,7 +7,7 @@ import * as Web3 from 'web3'; import { DummyERC20TokenContract } from '../src/contract_wrappers/generated/dummy_e_r_c20_token'; import { artifacts } from '../src/utils/artifacts'; -import { expectRevertOrAlwaysFailingTransaction } from '../src/utils/assertions'; +import { expectRevertOrAlwaysFailingTransaction, expectRevertOrOtherError } from '../src/utils/assertions'; import { chaiSetup } from '../src/utils/chai_setup'; import { constants } from '../src/utils/constants'; import { provider, txDefaults, web3Wrapper } from '../src/utils/web3_wrapper'; @@ -56,7 +56,8 @@ describe('UnlimitedAllowanceToken', () => { it('should throw if owner has insufficient balance', async () => { const ownerBalance = await token.balanceOf.callAsync(owner); const amountToTransfer = ownerBalance.plus(1); - return expect(token.transfer.callAsync(spender, amountToTransfer, { from: owner })).to.be.rejectedWith( + return expectRevertOrOtherError( + token.transfer.callAsync(spender, amountToTransfer, { from: owner }), constants.ERC20_INSUFFICIENT_BALANCE, ); }); @@ -94,11 +95,12 @@ describe('UnlimitedAllowanceToken', () => { await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); - return expect( + return expectRevertOrOtherError( token.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender, }), - ).to.be.rejectedWith(constants.ERC20_INSUFFICIENT_BALANCE); + constants.ERC20_INSUFFICIENT_BALANCE, + ); }); it('should throw if spender has insufficient allowance', async () => { @@ -109,11 +111,12 @@ describe('UnlimitedAllowanceToken', () => { const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0; expect(isSpenderAllowanceInsufficient).to.be.true(); - return expect( + return expectRevertOrOtherError( token.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender, }), - ).to.be.rejectedWith(constants.ERC20_INSUFFICIENT_ALLOWANCE); + constants.ERC20_INSUFFICIENT_ALLOWANCE, + ); }); it('should return true on a 0 value transfer', async () => { |