Replaced assertJump, assertRevert and expectThrow with shouldFail. (#1363)

* Replaced assertJump, assertRevert and expectThrow with shouldFail.

* Fixed linter errors.

* Fixed typo.

* Made the helpers async.

(cherry picked from commit b0da0fded0)
This commit is contained in:
Nicolás Venturo
2018-10-09 16:23:55 -03:00
committed by Leo Arias
parent 620d524398
commit 7cd0d5a452
45 changed files with 274 additions and 344 deletions

View File

@ -1,4 +1,4 @@
const { assertRevert } = require('../../helpers/assertRevert');
const shouldFail = require('../../helpers/shouldFail');
const { ZERO_ADDRESS } = require('../../helpers/constants');
const expectEvent = require('../../helpers/expectEvent');
@ -20,7 +20,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
});
it('reverts when querying roles for the null account', async function () {
await assertRevert(this.contract[`is${rolename}`](ZERO_ADDRESS));
await shouldFail.reverting(this.contract[`is${rolename}`](ZERO_ADDRESS));
});
describe('access control', function () {
@ -36,7 +36,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
const from = anyone;
it('reverts', async function () {
await assertRevert(this.contract[`only${rolename}Mock`]({ from }));
await shouldFail.reverting(this.contract[`only${rolename}Mock`]({ from }));
});
});
});
@ -58,7 +58,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
});
it('reverts when adding role to the null account', async function () {
await assertRevert(this.contract[`add${rolename}`](ZERO_ADDRESS, { from: authorized }));
await shouldFail.reverting(this.contract[`add${rolename}`](ZERO_ADDRESS, { from: authorized }));
});
});
@ -79,7 +79,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
});
it('reverts when removing role from the null account', async function () {
await assertRevert(this.contract[`remove${rolename}`](ZERO_ADDRESS));
await shouldFail.reverting(this.contract[`remove${rolename}`](ZERO_ADDRESS));
});
});