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, shouldFail, time } = require('openzeppelin-test-helpers');
const { BN, expectRevert, time } = require('openzeppelin-test-helpers');
const ERC20Mintable = artifacts.require('ERC20Mintable');
const TokenTimelock = artifacts.require('TokenTimelock');
@ -13,8 +13,9 @@ contract('TokenTimelock', function ([_, minter, beneficiary]) {
it('rejects a release time in the past', async function () {
const pastReleaseTime = (await time.latest()).sub(time.duration.years(1));
await shouldFail.reverting.withMessage(
TokenTimelock.new(this.token.address, beneficiary, pastReleaseTime)
await expectRevert(
TokenTimelock.new(this.token.address, beneficiary, pastReleaseTime),
'TokenTimelock: release time is before current time'
);
});
@ -32,12 +33,12 @@ contract('TokenTimelock', function ([_, minter, beneficiary]) {
});
it('cannot be released before time limit', async function () {
await shouldFail.reverting.withMessage(this.timelock.release());
await expectRevert(this.timelock.release(), 'TokenTimelock: current time is before release time');
});
it('cannot be released just before time limit', async function () {
await time.increaseTo(this.releaseTime.sub(time.duration.seconds(3)));
await shouldFail.reverting.withMessage(this.timelock.release());
await expectRevert(this.timelock.release(), 'TokenTimelock: current time is before release time');
});
it('can be released just after limit', async function () {
@ -55,7 +56,7 @@ contract('TokenTimelock', function ([_, minter, beneficiary]) {
it('cannot be released twice', async function () {
await time.increaseTo(this.releaseTime.add(time.duration.years(1)));
await this.timelock.release();
await shouldFail.reverting.withMessage(this.timelock.release());
await expectRevert(this.timelock.release(), 'TokenTimelock: no tokens to release');
(await this.token.balanceOf(beneficiary)).should.be.bignumber.equal(amount);
});
});