diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-06-07 04:43:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-07 04:43:29 +0800 |
commit | 785b9811f30869f01242ce9ff81c282bf7f5352f (patch) | |
tree | fe1615f0db90f76627bfb88874c19634321105bc /packages/contracts/test/unlimited_allowance_token.ts | |
parent | da3f783a9ff69b059b1a98f502d980660d6bacab (diff) | |
parent | 643c77ded08d3082aff7ae47063d40c9c1fdb677 (diff) | |
download | dexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.tar.gz dexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.tar.zst dexon-sol-tools-785b9811f30869f01242ce9ff81c282bf7f5352f.zip |
Merge pull request #622 from 0xProject/geth-devnet-rebase-on-v2
Run contract tests against private Geth network
Diffstat (limited to 'packages/contracts/test/unlimited_allowance_token.ts')
-rw-r--r-- | packages/contracts/test/unlimited_allowance_token.ts | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index b2acdebaa..9aa0a040a 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -7,6 +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 { expectRevertOrAlwaysFailingTransactionAsync, expectRevertOrOtherErrorAsync } 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'; @@ -55,8 +56,9 @@ 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( - constants.REVERT, + return expectRevertOrOtherErrorAsync( + token.transfer.callAsync(spender, amountToTransfer, { from: owner }), + constants.ERC20_INSUFFICIENT_BALANCE, ); }); @@ -93,11 +95,12 @@ describe('UnlimitedAllowanceToken', () => { await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); - return expect( + return expectRevertOrOtherErrorAsync( token.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender, }), - ).to.be.rejectedWith(constants.REVERT); + constants.ERC20_INSUFFICIENT_BALANCE, + ); }); it('should throw if spender has insufficient allowance', async () => { @@ -108,11 +111,12 @@ describe('UnlimitedAllowanceToken', () => { const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0; expect(isSpenderAllowanceInsufficient).to.be.true(); - return expect( + return expectRevertOrOtherErrorAsync( token.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender, }), - ).to.be.rejectedWith(constants.REVERT); + constants.ERC20_INSUFFICIENT_ALLOWANCE, + ); }); it('should return true on a 0 value transfer', async () => { |