Update test-helpers to v0.4.0. (#1770)

This commit is contained in:
Nicolás Venturo
2019-05-24 13:36:15 -03:00
committed by GitHub
parent 602d9d9884
commit a71c3bce32
53 changed files with 365 additions and 358 deletions

View File

@ -1,4 +1,4 @@
const { BN, constants, expectEvent, shouldFail, time } = require('openzeppelin-test-helpers');
const { BN, constants, expectEvent, expectRevert, time } = require('openzeppelin-test-helpers');
const { ZERO_ADDRESS } = constants;
const ERC20Mintable = artifacts.require('ERC20Mintable');
@ -20,14 +20,14 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
cliffDuration.should.be.bignumber.that.is.at.least(duration);
await shouldFail.reverting.withMessage(
await expectRevert(
TokenVesting.new(beneficiary, this.start, cliffDuration, duration, true, { from: owner }),
'TokenVesting: cliff is longer than duration'
);
});
it('reverts with a null beneficiary', async function () {
await shouldFail.reverting.withMessage(
await expectRevert(
TokenVesting.new(ZERO_ADDRESS, this.start, this.cliffDuration, this.duration, true, { from: owner }),
'TokenVesting: beneficiary is the zero address'
);
@ -35,7 +35,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
it('reverts with a null duration', async function () {
// cliffDuration should also be 0, since the duration must be larger than the cliff
await shouldFail.reverting.withMessage(
await expectRevert(
TokenVesting.new(beneficiary, this.start, 0, 0, true, { from: owner }), 'TokenVesting: duration is 0'
);
});
@ -44,7 +44,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
const now = await time.latest();
this.start = now.sub(this.duration).sub(time.duration.minutes(1));
await shouldFail.reverting.withMessage(
await expectRevert(
TokenVesting.new(beneficiary, this.start, this.cliffDuration, this.duration, true, { from: owner }),
'TokenVesting: final time is before current time'
);
@ -68,7 +68,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
});
it('cannot be released before cliff', async function () {
await shouldFail.reverting.withMessage(this.vesting.release(this.token.address),
await expectRevert(this.vesting.release(this.token.address),
'TokenVesting: no tokens are due'
);
});
@ -126,7 +126,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
beneficiary, this.start, this.cliffDuration, this.duration, false, { from: owner }
);
await shouldFail.reverting.withMessage(vesting.revoke(this.token.address, { from: owner }),
await expectRevert(vesting.revoke(this.token.address, { from: owner }),
'TokenVesting: cannot revoke'
);
});
@ -155,7 +155,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
it('should fail to be revoked a second time', async function () {
await this.vesting.revoke(this.token.address, { from: owner });
await shouldFail.reverting.withMessage(this.vesting.revoke(this.token.address, { from: owner }),
await expectRevert(this.vesting.revoke(this.token.address, { from: owner }),
'TokenVesting: token already revoked'
);
});