aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/unlimited_allowance_token.ts
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-06-07 04:43:29 +0800
committerGitHub <noreply@github.com>2018-06-07 04:43:29 +0800
commit785b9811f30869f01242ce9ff81c282bf7f5352f (patch)
treefe1615f0db90f76627bfb88874c19634321105bc /packages/contracts/test/unlimited_allowance_token.ts
parentda3f783a9ff69b059b1a98f502d980660d6bacab (diff)
parent643c77ded08d3082aff7ae47063d40c9c1fdb677 (diff)
downloaddexon-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.ts16
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 () => {