Update test-helpers to v0.4.0. (#1770)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
const { shouldFail } = require('openzeppelin-test-helpers');
|
||||
const { expectRevert } = require('openzeppelin-test-helpers');
|
||||
|
||||
const ERC20ReturnFalseMock = artifacts.require('ERC20ReturnFalseMock');
|
||||
const ERC20ReturnTrueMock = artifacts.require('ERC20ReturnTrueMock');
|
||||
@ -41,25 +41,25 @@ contract('SafeERC20', function ([_, hasNoCode]) {
|
||||
|
||||
function shouldRevertOnAllCalls (reason) {
|
||||
it('reverts on transfer', async function () {
|
||||
await shouldFail.reverting.withMessage(this.wrapper.transfer(), reason);
|
||||
await expectRevert(this.wrapper.transfer(), reason);
|
||||
});
|
||||
|
||||
it('reverts on transferFrom', async function () {
|
||||
await shouldFail.reverting.withMessage(this.wrapper.transferFrom(), reason);
|
||||
await expectRevert(this.wrapper.transferFrom(), reason);
|
||||
});
|
||||
|
||||
it('reverts on approve', async function () {
|
||||
await shouldFail.reverting.withMessage(this.wrapper.approve(0), reason);
|
||||
await expectRevert(this.wrapper.approve(0), reason);
|
||||
});
|
||||
|
||||
it('reverts on increaseAllowance', async function () {
|
||||
// [TODO] make sure it's reverting for the right reason
|
||||
await shouldFail.reverting(this.wrapper.increaseAllowance(0));
|
||||
await expectRevert.unspecified(this.wrapper.increaseAllowance(0));
|
||||
});
|
||||
|
||||
it('reverts on decreaseAllowance', async function () {
|
||||
// [TODO] make sure it's reverting for the right reason
|
||||
await shouldFail.reverting(this.wrapper.decreaseAllowance(0));
|
||||
await expectRevert.unspecified(this.wrapper.decreaseAllowance(0));
|
||||
});
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ function shouldOnlyRevertOnErrors () {
|
||||
});
|
||||
|
||||
it('reverts when decreasing the allowance', async function () {
|
||||
await shouldFail.reverting.withMessage(
|
||||
await expectRevert(
|
||||
this.wrapper.decreaseAllowance(10),
|
||||
'SafeMath: subtraction overflow'
|
||||
);
|
||||
@ -104,7 +104,7 @@ function shouldOnlyRevertOnErrors () {
|
||||
});
|
||||
|
||||
it('reverts when approving a non-zero allowance', async function () {
|
||||
await shouldFail.reverting.withMessage(
|
||||
await expectRevert(
|
||||
this.wrapper.approve(20),
|
||||
'SafeERC20: approve from non-zero to non-zero allowance'
|
||||
);
|
||||
@ -123,7 +123,7 @@ function shouldOnlyRevertOnErrors () {
|
||||
});
|
||||
|
||||
it('reverts when decreasing the allowance to a negative value', async function () {
|
||||
await shouldFail.reverting.withMessage(
|
||||
await expectRevert(
|
||||
this.wrapper.decreaseAllowance(200),
|
||||
'SafeMath: subtraction overflow'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user