Skip to content

Commit

Permalink
Changed equal(bool) to .to.be.bool
Browse files Browse the repository at this point in the history
  • Loading branch information
nventuro committed Aug 17, 2018
1 parent f8997ca commit 180ed89
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![NPM Package](https://img.shields.io/npm/v/openzeppelin-solidity.svg?style=flat-square)](https://www.npmjs.org/package/openzeppelin-solidity)

# OpenZeppelin Solidity
[![NPM Package](https://img.shields.io/npm/v/openzeppelin-solidity.svg?style=flat-square)](https://www.npmjs.org/package/openzeppelin-solidity)
[![Build Status](https://img.shields.io/travis/OpenZeppelin/openzeppelin-solidity.svg?branch=master&style=flat-square)](https://travis-ci.org/OpenZeppelin/openzeppelin-solidity)
Expand Down
2 changes: 1 addition & 1 deletion test/Bounty.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ contract('Bounty', function ([_, owner, researcher, nonTarget]) {
await this.bounty.claim(this.targetAddress, { from: researcher });
const claim = await this.bounty.claimed();

claim.should.equal(true);
claim.should.be.true;

const researcherPrevBalance = await ethGetBalance(researcher);

Expand Down
30 changes: 15 additions & 15 deletions test/access/SignatureBouncer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract('Bouncer', ([_, owner, anyone, bouncerAddress, authorizedUser]) => {

it('allows the owner to add a bouncer', async function () {
await this.bouncer.addBouncer(bouncerAddress, { from: owner });
(await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.equal(true);
(await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.be.true;
});

it('does not allow adding an invalid address', async function () {
Expand All @@ -39,7 +39,7 @@ contract('Bouncer', ([_, owner, anyone, bouncerAddress, authorizedUser]) => {
await this.bouncer.addBouncer(bouncerAddress, { from: owner });

await this.bouncer.removeBouncer(bouncerAddress, { from: owner });
(await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.equal(false);
(await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.be.false;
});

it('does not allow anyone to add a bouncer', async function () {
Expand Down Expand Up @@ -168,77 +168,77 @@ contract('Bouncer', ([_, owner, anyone, bouncerAddress, authorizedUser]) => {
context('signature validation', () => {
context('plain signature', () => {
it('validates valid signature for valid user', async function () {
(await this.bouncer.checkValidSignature(authorizedUser, this.signFor(authorizedUser))).should.equal(true);
(await this.bouncer.checkValidSignature(authorizedUser, this.signFor(authorizedUser))).should.be.true;
});

it('does not validate invalid signature for valid user', async function () {
(await this.bouncer.checkValidSignature(authorizedUser, INVALID_SIGNATURE)).should.equal(false);
(await this.bouncer.checkValidSignature(authorizedUser, INVALID_SIGNATURE)).should.be.false;
});

it('does not validate valid signature for anyone', async function () {
(await this.bouncer.checkValidSignature(anyone, this.signFor(authorizedUser))).should.equal(false);
(await this.bouncer.checkValidSignature(anyone, this.signFor(authorizedUser))).should.be.false;
});

it('does not validate valid signature for method for valid user', async function () {
(await this.bouncer.checkValidSignature(authorizedUser, this.signFor(authorizedUser, 'checkValidSignature'))
).should.equal(false);
).should.be.false;
});
});

context('method signature', () => {
it('validates valid signature with correct method for valid user', async function () {
(await this.bouncer.checkValidSignatureAndMethod(authorizedUser,
this.signFor(authorizedUser, 'checkValidSignatureAndMethod'))
).should.equal(true);
).should.be.true;
});

it('does not validate invalid signature with correct method for valid user', async function () {
(await this.bouncer.checkValidSignatureAndMethod(authorizedUser, INVALID_SIGNATURE)).should.equal(false);
(await this.bouncer.checkValidSignatureAndMethod(authorizedUser, INVALID_SIGNATURE)).should.be.false;
});

it('does not validate valid signature with correct method for anyone', async function () {
(await this.bouncer.checkValidSignatureAndMethod(anyone,
this.signFor(authorizedUser, 'checkValidSignatureAndMethod'))
).should.equal(false);
).should.be.false;
});

it('does not validate valid non-method signature with correct method for valid user', async function () {
(await this.bouncer.checkValidSignatureAndMethod(authorizedUser, this.signFor(authorizedUser))
).should.equal(false);
).should.be.false;
});
});

context('method and data signature', () => {
it('validates valid signature with correct method and data for valid user', async function () {
(await this.bouncer.checkValidSignatureAndData(authorizedUser, BYTES_VALUE, UINT_VALUE,
this.signFor(authorizedUser, 'checkValidSignatureAndData', [authorizedUser, BYTES_VALUE, UINT_VALUE]))
).should.equal(true);
).should.be.true;
});

it('does not validate invalid signature with correct method and data for valid user', async function () {
(await this.bouncer.checkValidSignatureAndData(authorizedUser, BYTES_VALUE, UINT_VALUE, INVALID_SIGNATURE)
).should.equal(false);
).should.be.false;
});

it('does not validate valid signature with correct method and incorrect data for valid user',
async function () {
(await this.bouncer.checkValidSignatureAndData(authorizedUser, BYTES_VALUE, UINT_VALUE + 10,
this.signFor(authorizedUser, 'checkValidSignatureAndData', [authorizedUser, BYTES_VALUE, UINT_VALUE]))
).should.equal(false);
).should.be.false;
}
);

it('does not validate valid signature with correct method and data for anyone', async function () {
(await this.bouncer.checkValidSignatureAndData(anyone, BYTES_VALUE, UINT_VALUE,
this.signFor(authorizedUser, 'checkValidSignatureAndData', [authorizedUser, BYTES_VALUE, UINT_VALUE]))
).should.equal(false);
).should.be.false;
});

it('does not validate valid non-method-data signature with correct method and data for valid user',
async function () {
(await this.bouncer.checkValidSignatureAndData(authorizedUser, BYTES_VALUE, UINT_VALUE,
this.signFor(authorizedUser, 'checkValidSignatureAndData'))
).should.equal(false);
).should.be.false;
}
);
});
Expand Down
6 changes: 3 additions & 3 deletions test/ownership/Superuser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ contract('Superuser', function ([_, firstOwner, newSuperuser, newOwner, anyone])

context('in normal conditions', () => {
it('should set the owner as the default superuser', async function () {
(await this.superuser.isSuperuser(firstOwner)).should.be.be.true;
(await this.superuser.isSuperuser(firstOwner)).should.be.true;
});

it('should change superuser after transferring', async function () {
await this.superuser.transferSuperuser(newSuperuser, { from: firstOwner });

(await this.superuser.isSuperuser(firstOwner)).should.be.be.false;
(await this.superuser.isSuperuser(firstOwner)).should.be.false;

(await this.superuser.isSuperuser(newSuperuser)).should.be.be.true;
(await this.superuser.isSuperuser(newSuperuser)).should.be.true;
});

it('should prevent changing to a null superuser', async function () {
Expand Down
8 changes: 4 additions & 4 deletions test/ownership/Whitelist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract('Whitelist', function ([_, owner, whitelistedAddress1, whitelistedAddre
'RoleAdded',
{ role: this.role },
);
(await this.mock.whitelist(whitelistedAddress1)).should.be.be.true;
(await this.mock.whitelist(whitelistedAddress1)).should.be.true;
});

it('should add addresses to the whitelist', async function () {
Expand All @@ -31,7 +31,7 @@ contract('Whitelist', function ([_, owner, whitelistedAddress1, whitelistedAddre
{ role: this.role },
);
for (const addr of whitelistedAddresses) {
(await this.mock.whitelist(addr)).should.be.be.true;
(await this.mock.whitelist(addr)).should.be.true;
}
});

Expand All @@ -41,7 +41,7 @@ contract('Whitelist', function ([_, owner, whitelistedAddress1, whitelistedAddre
'RoleRemoved',
{ role: this.role },
);
(await this.mock.whitelist(whitelistedAddress1)).should.be.be.false;
(await this.mock.whitelist(whitelistedAddress1)).should.be.false;
});

it('should remove addresses from the the whitelist', async function () {
Expand All @@ -51,7 +51,7 @@ contract('Whitelist', function ([_, owner, whitelistedAddress1, whitelistedAddre
{ role: this.role },
);
for (const addr of whitelistedAddresses) {
(await this.mock.whitelist(addr)).should.be.be.false;
(await this.mock.whitelist(addr)).should.be.false;
}
});

Expand Down

0 comments on commit 180ed89

Please sign in to comment.