Replace chai.should with chai.expect (#1780)

* changed exxpect to expect wherever applicable

* Merged with latest branch

* Updated merkleTree helper to latest master branch

* Made linting fixes

* Fix for test build

* updated for Coverage

* Updated Address.test.js

* Undo package-lock changes.
This commit is contained in:
Yohann Pereira
2019-06-24 16:40:05 -04:00
committed by Francisco Giordano
parent 852e11c2db
commit 489d2e85f1
57 changed files with 564 additions and 453 deletions

View File

@ -1,6 +1,8 @@
const { expectRevert, constants, expectEvent } = require('openzeppelin-test-helpers');
const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
function capitalize (str) {
return str.replace(/\b\w/g, l => l.toUpperCase());
}
@ -25,9 +27,9 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [other], rolen
describe('should behave like public role', function () {
beforeEach('check preconditions', async function () {
(await this.contract[`is${rolename}`](authorized)).should.equal(true);
(await this.contract[`is${rolename}`](otherAuthorized)).should.equal(true);
(await this.contract[`is${rolename}`](other)).should.equal(false);
expect(await this.contract[`is${rolename}`](authorized)).to.equal(true);
expect(await this.contract[`is${rolename}`](otherAuthorized)).to.equal(true);
expect(await this.contract[`is${rolename}`](other)).to.equal(false);
});
if (manager === undefined) { // Managed roles are only assigned by the manager, and none are set at construction
@ -70,7 +72,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [other], rolen
context(`from ${manager ? 'the manager' : 'a role-haver'} account`, function () {
it('adds role to a new account', async function () {
await this.contract[`add${rolename}`](other, { from });
(await this.contract[`is${rolename}`](other)).should.equal(true);
expect(await this.contract[`is${rolename}`](other)).to.equal(true);
});
it(`emits a ${rolename}Added event`, async function () {
@ -99,8 +101,8 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [other], rolen
context(`from ${manager ? 'the manager' : 'any'} account`, function () {
it('removes role from an already assigned account', async function () {
await this.contract[`remove${rolename}`](authorized, { from });
(await this.contract[`is${rolename}`](authorized)).should.equal(false);
(await this.contract[`is${rolename}`](otherAuthorized)).should.equal(true);
expect(await this.contract[`is${rolename}`](authorized)).to.equal(false);
expect(await this.contract[`is${rolename}`](otherAuthorized)).to.equal(true);
});
it(`emits a ${rolename}Removed event`, async function () {
@ -125,7 +127,7 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [other], rolen
describe('renouncing roles', function () {
it('renounces an assigned role', async function () {
await this.contract[`renounce${rolename}`]({ from: authorized });
(await this.contract[`is${rolename}`](authorized)).should.equal(false);
expect(await this.contract[`is${rolename}`](authorized)).to.equal(false);
});
it(`emits a ${rolename}Removed event`, async function () {