Update how constants is used.

This commit is contained in:
Nicolás Venturo
2019-01-11 16:30:52 -03:00
parent 53767a0963
commit 8c5d65de2f
19 changed files with 69 additions and 51 deletions

View File

@ -8,7 +8,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
});
it('reverts when querying roles for the null account', async function () {
await shouldFail.reverting(this.roles.has(constants.ZERO_ADDRESS));
await shouldFail.reverting(this.roles.has(ZERO_ADDRESS));
});
context('initially', function () {
@ -31,7 +31,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
});
it('reverts when adding roles to the null account', async function () {
await shouldFail.reverting(this.roles.add(constants.ZERO_ADDRESS));
await shouldFail.reverting(this.roles.add(ZERO_ADDRESS));
});
});
});
@ -54,7 +54,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
});
it('reverts when removing roles from the null account', async function () {
await shouldFail.reverting(this.roles.remove(constants.ZERO_ADDRESS));
await shouldFail.reverting(this.roles.remove(ZERO_ADDRESS));
});
});
});

View File

@ -1,4 +1,5 @@
const { shouldFail, constants, expectEvent } = require('openzeppelin-test-helpers');
const { ZERO_ADDRESS } = constants;
function capitalize (str) {
return str.replace(/\b\w/g, l => l.toUpperCase());
@ -23,7 +24,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
}
it('reverts when querying roles for the null account', async function () {
await shouldFail.reverting(this.contract[`is${rolename}`](constants.ZERO_ADDRESS));
await shouldFail.reverting(this.contract[`is${rolename}`](ZERO_ADDRESS));
});
describe('access control', function () {
@ -63,7 +64,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
});
it('reverts when adding role to the null account', async function () {
await shouldFail.reverting(this.contract[`add${rolename}`](constants.ZERO_ADDRESS, { from }));
await shouldFail.reverting(this.contract[`add${rolename}`](ZERO_ADDRESS, { from }));
});
});
});
@ -89,7 +90,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
});
it('reverts when removing role from the null account', async function () {
await shouldFail.reverting(this.contract[`remove${rolename}`](constants.ZERO_ADDRESS), { from });
await shouldFail.reverting(this.contract[`remove${rolename}`](ZERO_ADDRESS), { from });
});
});
});