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 { shouldFail, constants, expectEvent } = require('openzeppelin-test-helpers');
const { expectRevert, constants, expectEvent } = require('openzeppelin-test-helpers');
const { ZERO_ADDRESS } = constants;
function capitalize (str) {
@ -39,7 +39,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [other], rolen
}
it('reverts when querying roles for the null account', async function () {
await shouldFail.reverting.withMessage(this.contract[`is${rolename}`](ZERO_ADDRESS),
await expectRevert(this.contract[`is${rolename}`](ZERO_ADDRESS),
'Roles: account is the zero address'
);
});
@ -57,7 +57,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [other], rolen
const from = other;
it('reverts', async function () {
await shouldFail.reverting.withMessage(this.contract[`only${rolename}Mock`]({ from }),
await expectRevert(this.contract[`only${rolename}Mock`]({ from }),
`${rolename}Role: caller does not have the ${rolename} role`
);
});
@ -79,13 +79,13 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [other], rolen
});
it('reverts when adding role to an already assigned account', async function () {
await shouldFail.reverting.withMessage(this.contract[`add${rolename}`](authorized, { from }),
await expectRevert(this.contract[`add${rolename}`](authorized, { from }),
'Roles: account already has role'
);
});
it('reverts when adding role to the null account', async function () {
await shouldFail.reverting.withMessage(this.contract[`add${rolename}`](ZERO_ADDRESS, { from }),
await expectRevert(this.contract[`add${rolename}`](ZERO_ADDRESS, { from }),
'Roles: account is the zero address'
);
});
@ -109,13 +109,13 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [other], rolen
});
it('reverts when removing from an unassigned account', async function () {
await shouldFail.reverting.withMessage(this.contract[`remove${rolename}`](other, { from }),
await expectRevert(this.contract[`remove${rolename}`](other, { from }),
'Roles: account does not have role'
);
});
it('reverts when removing role from the null account', async function () {
await shouldFail.reverting.withMessage(this.contract[`remove${rolename}`](ZERO_ADDRESS, { from }),
await expectRevert(this.contract[`remove${rolename}`](ZERO_ADDRESS, { from }),
'Roles: account is the zero address'
);
});
@ -134,7 +134,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [other], rolen
});
it('reverts when renouncing unassigned role', async function () {
await shouldFail.reverting.withMessage(this.contract[`renounce${rolename}`]({ from: other }),
await expectRevert(this.contract[`renounce${rolename}`]({ from: other }),
'Roles: account does not have role'
);
});