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

@ -1,4 +1,5 @@
const { constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers');
const { ZERO_ADDRESS } = constants;
function shouldBehaveLikeOwnable (owner, [anyone]) {
describe('as an ownable', function () {
@ -20,14 +21,14 @@ function shouldBehaveLikeOwnable (owner, [anyone]) {
});
it('should guard ownership against stuck state', async function () {
await shouldFail.reverting(this.ownable.transferOwnership(constants.ZERO_ADDRESS, { from: owner }));
await shouldFail.reverting(this.ownable.transferOwnership(ZERO_ADDRESS, { from: owner }));
});
it('loses owner after renouncement', async function () {
const { logs } = await this.ownable.renounceOwnership({ from: owner });
expectEvent.inLogs(logs, 'OwnershipTransferred');
(await this.ownable.owner()).should.equal(constants.ZERO_ADDRESS);
(await this.ownable.owner()).should.equal(ZERO_ADDRESS);
});
it('should prevent non-owners from renouncement', async function () {

View File

@ -1,4 +1,5 @@
const { constants, expectEvent, shouldFail } = require('openzeppelin-test-helpers');
const { ZERO_ADDRESS } = constants;
const SecondaryMock = artifacts.require('SecondaryMock');
@ -29,7 +30,7 @@ contract('Secondary', function ([_, primary, newPrimary, anyone]) {
});
it('reverts when transfering to the null address', async function () {
await shouldFail.reverting(this.secondary.transferPrimary(constants.ZERO_ADDRESS, { from: primary }));
await shouldFail.reverting(this.secondary.transferPrimary(ZERO_ADDRESS, { from: primary }));
});
it('reverts when called by anyone', async function () {