From 4fb9bb702052c9402de349dca53bfb3fe5943c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Wed, 22 Aug 2018 16:05:18 -0300 Subject: [PATCH] Minor test style improvements (#1219) * Changed .eq to .equal * Changed equal(bool) to .to.be.bool * Changed be.bool to equal(bool), disallowed unused expressions. --- README.md | 2 +- test/.eslintrc | 5 --- test/Bounty.test.js | 2 +- test/Heritable.test.js | 24 +++++++------- test/access/SignatureBouncer.test.js | 32 +++++++++---------- test/crowdsale/AllowanceCrowdsale.test.js | 4 +-- test/crowdsale/CappedCrowdsale.test.js | 6 ++-- test/crowdsale/Crowdsale.test.js | 8 ++--- test/crowdsale/MintedCrowdsale.behavior.js | 4 +-- test/crowdsale/MintedCrowdsale.test.js | 4 +-- test/crowdsale/TimedCrowdsale.test.js | 4 +-- test/crowdsale/WhitelistedCrowdsale.test.js | 10 +++--- test/examples/SampleCrowdsale.test.js | 6 ++-- test/examples/SimpleToken.test.js | 6 ++-- test/helpers/expectEvent.js | 2 +- .../SupportsInterface.behavior.js | 2 +- test/library/ECRecovery.test.js | 10 +++--- test/library/MerkleProof.test.js | 6 ++-- test/lifecycle/Pausable.test.js | 6 ++-- test/ownership/Claimable.test.js | 6 ++-- test/ownership/Contactable.test.js | 4 +-- test/ownership/DelayedClaimable.test.js | 8 ++--- test/ownership/HasNoContracts.test.js | 2 +- test/ownership/Ownable.behavior.js | 6 ++-- test/ownership/Superuser.test.js | 6 ++-- test/ownership/Whitelist.test.js | 8 ++--- test/payment/SplitPayment.test.js | 2 +- test/proposals/ERC1046/TokenMetadata.test.js | 2 +- test/token/ERC20/MintableToken.behavior.js | 6 ++-- test/token/ERC20/PausableToken.test.js | 10 +++--- .../token/ERC20/RBACMintableToken.behavior.js | 4 +-- .../token/ERC721/ERC721BasicToken.behavior.js | 14 ++++---- test/token/ERC721/ERC721Token.test.js | 2 +- 33 files changed, 109 insertions(+), 114 deletions(-) delete mode 100644 test/.eslintrc diff --git a/README.md b/README.md index 5e38652ce..c5e90a0fe 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ The following provides visibility into how OpenZeppelin's contracts are organize - **ERC20** - A standard interface for fungible tokens: - *Interfaces* - Includes the ERC-20 token standard basic interface. I.e., what the contract’s ABI can represent. - *Implementations* - Includes ERC-20 token implementations that include all required and some optional ERC-20 functionality. - - **ERC721** - A standard interface for non-fungible tokens + - **ERC721** - A standard interface for non-fungible tokens - *Interfaces* - Includes the ERC-721 token standard basic interface. I.e., what the contract’s ABI can represent. - *Implementations* - Includes ERC-721 token implementations that include all required and some optional ERC-721 functionality. diff --git a/test/.eslintrc b/test/.eslintrc deleted file mode 100644 index 9609ab5d0..000000000 --- a/test/.eslintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "rules": { - "no-unused-expressions": 0 - } -} diff --git a/test/Bounty.test.js b/test/Bounty.test.js index 7438ab022..0f1aa4212 100644 --- a/test/Bounty.test.js +++ b/test/Bounty.test.js @@ -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.eq(true); + claim.should.equal(true); const researcherPrevBalance = await ethGetBalance(researcher); diff --git a/test/Heritable.test.js b/test/Heritable.test.js index 631975309..770364179 100644 --- a/test/Heritable.test.js +++ b/test/Heritable.test.js @@ -38,10 +38,10 @@ contract('Heritable', function ([_, owner, heir, anyone]) { it('owner can remove heir', async function () { await heritable.setHeir(heir, { from: owner }); - (await heritable.heir()).should.eq(heir); + (await heritable.heir()).should.equal(heir); await heritable.removeHeir({ from: owner }); - (await heritable.heir()).should.eq(NULL_ADDRESS); + (await heritable.heir()).should.equal(NULL_ADDRESS); }); it('heir can claim ownership only if owner is dead and timeout was reached', async function () { @@ -54,7 +54,7 @@ contract('Heritable', function ([_, owner, heir, anyone]) { await increaseTime(heartbeatTimeout); await heritable.claimHeirOwnership({ from: heir }); - (await heritable.heir()).should.eq(heir); + (await heritable.heir()).should.equal(heir); }); it('only heir can proclaim death', async function () { @@ -85,29 +85,29 @@ contract('Heritable', function ([_, owner, heir, anyone]) { const setHeirLogs = (await heritable.setHeir(heir, { from: owner })).logs; const setHeirEvent = setHeirLogs.find(e => e.event === 'HeirChanged'); - setHeirEvent.args.owner.should.eq(owner); - setHeirEvent.args.newHeir.should.eq(heir); + setHeirEvent.args.owner.should.equal(owner); + setHeirEvent.args.newHeir.should.equal(heir); const heartbeatLogs = (await heritable.heartbeat({ from: owner })).logs; const heartbeatEvent = heartbeatLogs.find(e => e.event === 'OwnerHeartbeated'); - heartbeatEvent.args.owner.should.eq(owner); + heartbeatEvent.args.owner.should.equal(owner); const proclaimDeathLogs = (await heritable.proclaimDeath({ from: heir })).logs; const ownerDeadEvent = proclaimDeathLogs.find(e => e.event === 'OwnerProclaimedDead'); - ownerDeadEvent.args.owner.should.eq(owner); - ownerDeadEvent.args.heir.should.eq(heir); + ownerDeadEvent.args.owner.should.equal(owner); + ownerDeadEvent.args.heir.should.equal(heir); await increaseTime(heartbeatTimeout); const claimHeirOwnershipLogs = (await heritable.claimHeirOwnership({ from: heir })).logs; const ownershipTransferredEvent = claimHeirOwnershipLogs.find(e => e.event === 'OwnershipTransferred'); const heirOwnershipClaimedEvent = claimHeirOwnershipLogs.find(e => e.event === 'HeirOwnershipClaimed'); - ownershipTransferredEvent.args.previousOwner.should.eq(owner); - ownershipTransferredEvent.args.newOwner.should.eq(heir); - heirOwnershipClaimedEvent.args.previousOwner.should.eq(owner); - heirOwnershipClaimedEvent.args.newOwner.should.eq(heir); + ownershipTransferredEvent.args.previousOwner.should.equal(owner); + ownershipTransferredEvent.args.newOwner.should.equal(heir); + heirOwnershipClaimedEvent.args.previousOwner.should.equal(owner); + heirOwnershipClaimedEvent.args.newOwner.should.equal(heir); }); it('timeOfDeath can be queried', async function () { diff --git a/test/access/SignatureBouncer.test.js b/test/access/SignatureBouncer.test.js index 47d734ddf..20bc85427 100644 --- a/test/access/SignatureBouncer.test.js +++ b/test/access/SignatureBouncer.test.js @@ -21,12 +21,12 @@ contract('Bouncer', function ([_, owner, anyone, bouncerAddress, authorizedUser] context('management', function () { it('has a default owner of self', async function () { - (await this.bouncer.owner()).should.eq(owner); + (await this.bouncer.owner()).should.equal(owner); }); 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.eq(true); + (await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.equal(true); }); it('does not allow adding an invalid address', async function () { @@ -39,7 +39,7 @@ contract('Bouncer', function ([_, 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.eq(false); + (await this.bouncer.hasRole(bouncerAddress, this.roleBouncer)).should.equal(false); }); it('does not allow anyone to add a bouncer', async function () { @@ -168,20 +168,20 @@ contract('Bouncer', function ([_, owner, anyone, bouncerAddress, authorizedUser] context('signature validation', function () { context('plain signature', function () { it('validates valid signature for valid user', async function () { - (await this.bouncer.checkValidSignature(authorizedUser, this.signFor(authorizedUser))).should.eq(true); + (await this.bouncer.checkValidSignature(authorizedUser, this.signFor(authorizedUser))).should.equal(true); }); it('does not validate invalid signature for valid user', async function () { - (await this.bouncer.checkValidSignature(authorizedUser, INVALID_SIGNATURE)).should.eq(false); + (await this.bouncer.checkValidSignature(authorizedUser, INVALID_SIGNATURE)).should.equal(false); }); it('does not validate valid signature for anyone', async function () { - (await this.bouncer.checkValidSignature(anyone, this.signFor(authorizedUser))).should.eq(false); + (await this.bouncer.checkValidSignature(anyone, this.signFor(authorizedUser))).should.equal(false); }); it('does not validate valid signature for method for valid user', async function () { (await this.bouncer.checkValidSignature(authorizedUser, this.signFor(authorizedUser, 'checkValidSignature')) - ).should.eq(false); + ).should.equal(false); }); }); @@ -189,22 +189,22 @@ contract('Bouncer', function ([_, owner, anyone, bouncerAddress, authorizedUser] it('validates valid signature with correct method for valid user', async function () { (await this.bouncer.checkValidSignatureAndMethod(authorizedUser, this.signFor(authorizedUser, 'checkValidSignatureAndMethod')) - ).should.eq(true); + ).should.equal(true); }); it('does not validate invalid signature with correct method for valid user', async function () { - (await this.bouncer.checkValidSignatureAndMethod(authorizedUser, INVALID_SIGNATURE)).should.eq(false); + (await this.bouncer.checkValidSignatureAndMethod(authorizedUser, INVALID_SIGNATURE)).should.equal(false); }); it('does not validate valid signature with correct method for anyone', async function () { (await this.bouncer.checkValidSignatureAndMethod(anyone, this.signFor(authorizedUser, 'checkValidSignatureAndMethod')) - ).should.eq(false); + ).should.equal(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.eq(false); + ).should.equal(false); }); }); @@ -212,33 +212,33 @@ contract('Bouncer', function ([_, owner, anyone, bouncerAddress, authorizedUser] 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.eq(true); + ).should.equal(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.eq(false); + ).should.equal(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.eq(false); + ).should.equal(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.eq(false); + ).should.equal(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.eq(false); + ).should.equal(false); } ); }); diff --git a/test/crowdsale/AllowanceCrowdsale.test.js b/test/crowdsale/AllowanceCrowdsale.test.js index f3f907f35..26a19c78c 100644 --- a/test/crowdsale/AllowanceCrowdsale.test.js +++ b/test/crowdsale/AllowanceCrowdsale.test.js @@ -39,8 +39,8 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW const { logs } = await this.crowdsale.sendTransaction({ value: value, from: investor }); const event = logs.find(e => e.event === 'TokenPurchase'); should.exist(event); - event.args.purchaser.should.eq(investor); - event.args.beneficiary.should.eq(investor); + event.args.purchaser.should.equal(investor); + event.args.beneficiary.should.equal(investor); event.args.value.should.be.bignumber.equal(value); event.args.amount.should.be.bignumber.equal(expectedTokenAmount); }); diff --git a/test/crowdsale/CappedCrowdsale.test.js b/test/crowdsale/CappedCrowdsale.test.js index df00d3c97..d7a1bf625 100644 --- a/test/crowdsale/CappedCrowdsale.test.js +++ b/test/crowdsale/CappedCrowdsale.test.js @@ -57,17 +57,17 @@ contract('CappedCrowdsale', function ([_, wallet]) { describe('ending', function () { it('should not reach cap if sent under cap', async function () { await this.crowdsale.send(lessThanCap); - (await this.crowdsale.capReached()).should.be.false; + (await this.crowdsale.capReached()).should.equal(false); }); it('should not reach cap if sent just under cap', async function () { await this.crowdsale.send(cap.minus(1)); - (await this.crowdsale.capReached()).should.be.false; + (await this.crowdsale.capReached()).should.equal(false); }); it('should reach cap if cap sent', async function () { await this.crowdsale.send(cap); - (await this.crowdsale.capReached()).should.be.true; + (await this.crowdsale.capReached()).should.equal(true); }); }); }); diff --git a/test/crowdsale/Crowdsale.test.js b/test/crowdsale/Crowdsale.test.js index bf32f94ca..d08cf9e66 100644 --- a/test/crowdsale/Crowdsale.test.js +++ b/test/crowdsale/Crowdsale.test.js @@ -84,8 +84,8 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) { const { logs } = await this.crowdsale.sendTransaction({ value: value, from: investor }); const event = logs.find(e => e.event === 'TokenPurchase'); should.exist(event); - event.args.purchaser.should.eq(investor); - event.args.beneficiary.should.eq(investor); + event.args.purchaser.should.equal(investor); + event.args.beneficiary.should.equal(investor); event.args.value.should.be.bignumber.equal(value); event.args.amount.should.be.bignumber.equal(expectedTokenAmount); }); @@ -108,8 +108,8 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) { const { logs } = await this.crowdsale.buyTokens(investor, { value: value, from: purchaser }); const event = logs.find(e => e.event === 'TokenPurchase'); should.exist(event); - event.args.purchaser.should.eq(purchaser); - event.args.beneficiary.should.eq(investor); + event.args.purchaser.should.equal(purchaser); + event.args.beneficiary.should.equal(investor); event.args.value.should.be.bignumber.equal(value); event.args.amount.should.be.bignumber.equal(expectedTokenAmount); }); diff --git a/test/crowdsale/MintedCrowdsale.behavior.js b/test/crowdsale/MintedCrowdsale.behavior.js index e77328d6a..e7d3053be 100644 --- a/test/crowdsale/MintedCrowdsale.behavior.js +++ b/test/crowdsale/MintedCrowdsale.behavior.js @@ -22,8 +22,8 @@ function shouldBehaveLikeMintedCrowdsale ([_, investor, wallet, purchaser], rate const { logs } = await this.crowdsale.sendTransaction({ value: value, from: investor }); const event = logs.find(e => e.event === 'TokenPurchase'); should.exist(event); - event.args.purchaser.should.eq(investor); - event.args.beneficiary.should.eq(investor); + event.args.purchaser.should.equal(investor); + event.args.beneficiary.should.equal(investor); event.args.value.should.be.bignumber.equal(value); event.args.amount.should.be.bignumber.equal(expectedTokenAmount); }); diff --git a/test/crowdsale/MintedCrowdsale.test.js b/test/crowdsale/MintedCrowdsale.test.js index bf7267b50..f0a74bd15 100644 --- a/test/crowdsale/MintedCrowdsale.test.js +++ b/test/crowdsale/MintedCrowdsale.test.js @@ -19,7 +19,7 @@ contract('MintedCrowdsale', function ([_, investor, wallet, purchaser]) { }); it('should be token owner', async function () { - (await this.token.owner()).should.eq(this.crowdsale.address); + (await this.token.owner()).should.equal(this.crowdsale.address); }); shouldBehaveLikeMintedCrowdsale([_, investor, wallet, purchaser], rate, value); @@ -35,7 +35,7 @@ contract('MintedCrowdsale', function ([_, investor, wallet, purchaser]) { }); it('should have minter role on token', async function () { - (await this.token.hasRole(this.crowdsale.address, ROLE_MINTER)).should.be.true; + (await this.token.hasRole(this.crowdsale.address, ROLE_MINTER)).should.equal(true); }); shouldBehaveLikeMintedCrowdsale([_, investor, wallet, purchaser], rate, value); diff --git a/test/crowdsale/TimedCrowdsale.test.js b/test/crowdsale/TimedCrowdsale.test.js index 3183b2640..4456ee07e 100644 --- a/test/crowdsale/TimedCrowdsale.test.js +++ b/test/crowdsale/TimedCrowdsale.test.js @@ -34,9 +34,9 @@ contract('TimedCrowdsale', function ([_, investor, wallet, purchaser]) { }); it('should be ended only after end', async function () { - (await this.crowdsale.hasClosed()).should.be.false; + (await this.crowdsale.hasClosed()).should.equal(false); await increaseTimeTo(this.afterClosingTime); - (await this.crowdsale.hasClosed()).should.be.true; + (await this.crowdsale.hasClosed()).should.equal(true); }); describe('accepting payments', function () { diff --git a/test/crowdsale/WhitelistedCrowdsale.test.js b/test/crowdsale/WhitelistedCrowdsale.test.js index 2d67bfd5f..a20af2846 100644 --- a/test/crowdsale/WhitelistedCrowdsale.test.js +++ b/test/crowdsale/WhitelistedCrowdsale.test.js @@ -43,8 +43,8 @@ contract('WhitelistedCrowdsale', function ([_, wallet, authorized, unauthorized, describe('reporting whitelisted', function () { it('should correctly report whitelisted addresses', async function () { - (await this.crowdsale.whitelist(authorized)).should.be.true; - (await this.crowdsale.whitelist(unauthorized)).should.be.false; + (await this.crowdsale.whitelist(authorized)).should.equal(true); + (await this.crowdsale.whitelist(unauthorized)).should.equal(false); }); }); }); @@ -80,9 +80,9 @@ contract('WhitelistedCrowdsale', function ([_, wallet, authorized, unauthorized, describe('reporting whitelisted', function () { it('should correctly report whitelisted addresses', async function () { - (await this.crowdsale.whitelist(authorized)).should.be.true; - (await this.crowdsale.whitelist(anotherAuthorized)).should.be.true; - (await this.crowdsale.whitelist(unauthorized)).should.be.false; + (await this.crowdsale.whitelist(authorized)).should.equal(true); + (await this.crowdsale.whitelist(anotherAuthorized)).should.equal(true); + (await this.crowdsale.whitelist(unauthorized)).should.equal(false); }); }); }); diff --git a/test/examples/SampleCrowdsale.test.js b/test/examples/SampleCrowdsale.test.js index 6d30b2b81..f7b88080f 100644 --- a/test/examples/SampleCrowdsale.test.js +++ b/test/examples/SampleCrowdsale.test.js @@ -9,7 +9,7 @@ const { ethGetBalance } = require('../helpers/web3'); const BigNumber = web3.BigNumber; -require('chai') +const should = require('chai') .use(require('chai-bignumber')(BigNumber)) .should(); @@ -40,8 +40,8 @@ contract('SampleCrowdsale', function ([_, owner, wallet, investor]) { }); it('should create crowdsale with correct parameters', async function () { - this.crowdsale.should.exist; - this.token.should.exist; + should.exist(this.crowdsale); + should.exist(this.token); (await this.crowdsale.openingTime()).should.be.bignumber.equal(this.openingTime); (await this.crowdsale.closingTime()).should.be.bignumber.equal(this.closingTime); diff --git a/test/examples/SimpleToken.test.js b/test/examples/SimpleToken.test.js index 89b54c37f..a28cf4641 100644 --- a/test/examples/SimpleToken.test.js +++ b/test/examples/SimpleToken.test.js @@ -17,11 +17,11 @@ contract('SimpleToken', function ([_, creator]) { }); it('has a name', async function () { - (await token.name()).should.eq('SimpleToken'); + (await token.name()).should.equal('SimpleToken'); }); it('has a symbol', async function () { - (await token.symbol()).should.eq('SIM'); + (await token.symbol()).should.equal('SIM'); }); it('has 18 decimals', async function () { @@ -36,7 +36,7 @@ contract('SimpleToken', function ([_, creator]) { const receipt = await web3.eth.getTransactionReceipt(token.transactionHash); const logs = decodeLogs(receipt.logs, SimpleToken, token.address); - logs.length.should.eq(1); + logs.length.should.equal(1); logs[0].event.should.equal('Transfer'); logs[0].args.from.valueOf().should.equal(ZERO_ADDRESS); logs[0].args.to.valueOf().should.equal(creator); diff --git a/test/helpers/expectEvent.js b/test/helpers/expectEvent.js index 1bfacd6f2..565d61fe5 100644 --- a/test/helpers/expectEvent.js +++ b/test/helpers/expectEvent.js @@ -5,7 +5,7 @@ function inLogs (logs, eventName, eventArgs = {}) { should.exist(event); for (const [k, v] of Object.entries(eventArgs)) { should.exist(event.args[k]); - event.args[k].should.eq(v); + event.args[k].should.equal(v); } return event; } diff --git a/test/introspection/SupportsInterface.behavior.js b/test/introspection/SupportsInterface.behavior.js index 395e868a7..838787f72 100644 --- a/test/introspection/SupportsInterface.behavior.js +++ b/test/introspection/SupportsInterface.behavior.js @@ -44,7 +44,7 @@ function shouldSupportInterfaces (interfaces = []) { }); it('is supported', async function () { - (await this.thing.supportsInterface(interfaceId)).should.be.true; + (await this.thing.supportsInterface(interfaceId)).should.equal(true); }); }); } diff --git a/test/library/ECRecovery.test.js b/test/library/ECRecovery.test.js index 8e7fd6cc3..9e33f7fcc 100644 --- a/test/library/ECRecovery.test.js +++ b/test/library/ECRecovery.test.js @@ -20,7 +20,7 @@ contract('ECRecovery', function ([_, anyone]) { const message = web3.sha3(TEST_MESSAGE); // eslint-disable-next-line max-len const signature = '0x5d99b6f7f6d1f73d1a26497f2b1c89b24c0993913f86e9a2d02cd69887d9c94f3c880358579d811b21dd1b7fd9bb01c1d81d10e69f0384e675c32b39643be89200'; - (await ecrecovery.recover(message, signature)).should.eq(signer); + (await ecrecovery.recover(message, signature)).should.equal(signer); }); it('recover v1', async function () { @@ -29,7 +29,7 @@ contract('ECRecovery', function ([_, anyone]) { const message = web3.sha3(TEST_MESSAGE); // eslint-disable-next-line max-len const signature = '0x331fe75a821c982f9127538858900d87d3ec1f9f737338ad67cad133fa48feff48e6fa0c18abc62e42820f05943e47af3e9fbe306ce74d64094bdf1691ee53e001'; - (await ecrecovery.recover(message, signature)).should.eq(signer); + (await ecrecovery.recover(message, signature)).should.equal(signer); }); it('recover using web3.eth.sign()', async function () { @@ -40,7 +40,7 @@ contract('ECRecovery', function ([_, anyone]) { (await ecrecovery.recover( hashMessage(TEST_MESSAGE), signature - )).should.eq(anyone); + )).should.equal(anyone); }); it('recover using web3.eth.sign() should return wrong signer', async function () { @@ -48,7 +48,7 @@ contract('ECRecovery', function ([_, anyone]) { const signature = signMessage(anyone, web3.sha3(TEST_MESSAGE)); // Recover the signer address from the generated message and wrong signature. - (await ecrecovery.recover(hashMessage('Nope'), signature)).should.not.eq(anyone); + (await ecrecovery.recover(hashMessage('Nope'), signature)).should.not.equal(anyone); }); it('recover should revert when a small hash is sent', async function () { @@ -66,7 +66,7 @@ contract('ECRecovery', function ([_, anyone]) { context('toEthSignedMessage', function () { it('should prefix hashes correctly', async function () { const hashedMessage = web3.sha3(TEST_MESSAGE); - (await ecrecovery.toEthSignedMessageHash(hashedMessage)).should.eq(hashMessage(TEST_MESSAGE)); + (await ecrecovery.toEthSignedMessageHash(hashedMessage)).should.equal(hashMessage(TEST_MESSAGE)); }); }); }); diff --git a/test/library/MerkleProof.test.js b/test/library/MerkleProof.test.js index 3c221208e..cba5d69f5 100644 --- a/test/library/MerkleProof.test.js +++ b/test/library/MerkleProof.test.js @@ -24,7 +24,7 @@ contract('MerkleProof', function () { const leaf = bufferToHex(sha3(elements[0])); - (await merkleProof.verifyProof(proof, root, leaf)).should.be.true; + (await merkleProof.verifyProof(proof, root, leaf)).should.equal(true); }); it('should return false for an invalid Merkle proof', async function () { @@ -40,7 +40,7 @@ contract('MerkleProof', function () { const badProof = badMerkleTree.getHexProof(badElements[0]); - (await merkleProof.verifyProof(badProof, correctRoot, correctLeaf)).should.be.false; + (await merkleProof.verifyProof(badProof, correctRoot, correctLeaf)).should.equal(false); }); it('should return false for a Merkle proof of invalid length', async function () { @@ -54,7 +54,7 @@ contract('MerkleProof', function () { const leaf = bufferToHex(sha3(elements[0])); - (await merkleProof.verifyProof(badProof, root, leaf)).should.be.false; + (await merkleProof.verifyProof(badProof, root, leaf)).should.equal(false); }); }); }); diff --git a/test/lifecycle/Pausable.test.js b/test/lifecycle/Pausable.test.js index 9a6e25b6a..9dc26b573 100644 --- a/test/lifecycle/Pausable.test.js +++ b/test/lifecycle/Pausable.test.js @@ -29,13 +29,13 @@ contract('Pausable', function () { it('can not take drastic measure in non-pause', async function () { await assertRevert(this.Pausable.drasticMeasure()); - (await this.Pausable.drasticMeasureTaken()).should.be.false; + (await this.Pausable.drasticMeasureTaken()).should.equal(false); }); it('can take a drastic measure in a pause', async function () { await this.Pausable.pause(); await this.Pausable.drasticMeasure(); - (await this.Pausable.drasticMeasureTaken()).should.be.true; + (await this.Pausable.drasticMeasureTaken()).should.equal(true); }); it('should resume allowing normal process after pause is over', async function () { @@ -51,6 +51,6 @@ contract('Pausable', function () { await assertRevert(this.Pausable.drasticMeasure()); - (await this.Pausable.drasticMeasureTaken()).should.be.false; + (await this.Pausable.drasticMeasureTaken()).should.equal(false); }); }); diff --git a/test/ownership/Claimable.test.js b/test/ownership/Claimable.test.js index 97c041712..bfc1355d5 100644 --- a/test/ownership/Claimable.test.js +++ b/test/ownership/Claimable.test.js @@ -16,12 +16,12 @@ contract('Claimable', function ([_, owner, newOwner, anyone]) { }); it('should have an owner', async function () { - (await claimable.owner()).should.not.eq(0); + (await claimable.owner()).should.not.equal(0); }); it('changes pendingOwner after transfer', async function () { await claimable.transferOwnership(newOwner, { from: owner }); - (await claimable.pendingOwner()).should.eq(newOwner); + (await claimable.pendingOwner()).should.equal(newOwner); }); it('should prevent to claimOwnership from anyone', async function () { @@ -40,7 +40,7 @@ contract('Claimable', function ([_, owner, newOwner, anyone]) { it('changes allow pending owner to claim ownership', async function () { await claimable.claimOwnership({ from: newOwner }); - (await claimable.owner()).should.eq(newOwner); + (await claimable.owner()).should.equal(newOwner); }); }); }); diff --git a/test/ownership/Contactable.test.js b/test/ownership/Contactable.test.js index de0ca4d1d..bae2d201a 100644 --- a/test/ownership/Contactable.test.js +++ b/test/ownership/Contactable.test.js @@ -8,7 +8,7 @@ contract('Contactable', function () { }); it('should have an empty contact info', async function () { - (await contactable.contactInformation()).should.eq(''); + (await contactable.contactInformation()).should.equal(''); }); describe('after setting the contact information', function () { @@ -19,7 +19,7 @@ contract('Contactable', function () { }); it('should return the setted contact information', async function () { - (await contactable.contactInformation()).should.eq(contactInfo); + (await contactable.contactInformation()).should.equal(contactInfo); }); }); }); diff --git a/test/ownership/DelayedClaimable.test.js b/test/ownership/DelayedClaimable.test.js index 0765f17c3..e65ac86c4 100644 --- a/test/ownership/DelayedClaimable.test.js +++ b/test/ownership/DelayedClaimable.test.js @@ -30,9 +30,9 @@ contract('DelayedClaimable', function ([_, owner, newOwner]) { (await this.delayedClaimable.start()).should.be.bignumber.equal(0); - (await this.delayedClaimable.pendingOwner()).should.eq(newOwner); + (await this.delayedClaimable.pendingOwner()).should.equal(newOwner); await this.delayedClaimable.claimOwnership({ from: newOwner }); - (await this.delayedClaimable.owner()).should.eq(newOwner); + (await this.delayedClaimable.owner()).should.equal(newOwner); }); it('changes pendingOwner after transfer fails', async function () { @@ -43,9 +43,9 @@ contract('DelayedClaimable', function ([_, owner, newOwner]) { (await this.delayedClaimable.start()).should.be.bignumber.equal(100); - (await this.delayedClaimable.pendingOwner()).should.eq(newOwner); + (await this.delayedClaimable.pendingOwner()).should.equal(newOwner); await assertRevert(this.delayedClaimable.claimOwnership({ from: newOwner })); - (await this.delayedClaimable.owner()).should.not.eq(newOwner); + (await this.delayedClaimable.owner()).should.not.equal(newOwner); }); it('set end and start invalid values fail', async function () { diff --git a/test/ownership/HasNoContracts.test.js b/test/ownership/HasNoContracts.test.js index d891e3bd6..f900fb1cb 100644 --- a/test/ownership/HasNoContracts.test.js +++ b/test/ownership/HasNoContracts.test.js @@ -18,7 +18,7 @@ contract('HasNoContracts', function ([_, owner, anyone]) { it('should allow owner to reclaim contracts', async function () { await hasNoContracts.reclaimContract(ownable.address, { from: owner }); - (await ownable.owner()).should.eq(owner); + (await ownable.owner()).should.equal(owner); }); it('should allow only owner to reclaim contracts', async function () { diff --git a/test/ownership/Ownable.behavior.js b/test/ownership/Ownable.behavior.js index aa95e04e2..6257c01df 100644 --- a/test/ownership/Ownable.behavior.js +++ b/test/ownership/Ownable.behavior.js @@ -9,12 +9,12 @@ require('chai') function shouldBehaveLikeOwnable (owner, [anyone]) { describe('as an ownable', function () { it('should have an owner', async function () { - (await this.ownable.owner()).should.eq(owner); + (await this.ownable.owner()).should.equal(owner); }); it('changes owner after transfer', async function () { await this.ownable.transferOwnership(anyone, { from: owner }); - (await this.ownable.owner()).should.eq(anyone); + (await this.ownable.owner()).should.equal(anyone); }); it('should prevent non-owners from transfering', async function () { @@ -27,7 +27,7 @@ function shouldBehaveLikeOwnable (owner, [anyone]) { it('loses owner after renouncement', async function () { await this.ownable.renounceOwnership({ from: owner }); - (await this.ownable.owner()).should.eq(ZERO_ADDRESS); + (await this.ownable.owner()).should.equal(ZERO_ADDRESS); }); it('should prevent non-owners from renouncement', async function () { diff --git a/test/ownership/Superuser.test.js b/test/ownership/Superuser.test.js index 3eac42a73..5e4d2c324 100644 --- a/test/ownership/Superuser.test.js +++ b/test/ownership/Superuser.test.js @@ -15,15 +15,15 @@ contract('Superuser', function ([_, firstOwner, newSuperuser, newOwner, anyone]) context('in normal conditions', function () { 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.equal(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.equal(false); - (await this.superuser.isSuperuser(newSuperuser)).should.be.be.true; + (await this.superuser.isSuperuser(newSuperuser)).should.equal(true); }); it('should prevent changing to a null superuser', async function () { diff --git a/test/ownership/Whitelist.test.js b/test/ownership/Whitelist.test.js index 49391f179..411978d6e 100644 --- a/test/ownership/Whitelist.test.js +++ b/test/ownership/Whitelist.test.js @@ -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.equal(true); }); it('should add addresses to the whitelist', async function () { @@ -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.equal(true); } }); @@ -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.equal(false); }); it('should remove addresses from the the whitelist', async function () { @@ -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.equal(false); } }); diff --git a/test/payment/SplitPayment.test.js b/test/payment/SplitPayment.test.js index bc950e5b2..d55a9968d 100644 --- a/test/payment/SplitPayment.test.js +++ b/test/payment/SplitPayment.test.js @@ -53,7 +53,7 @@ contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1, }); it('should store shares if address is payee', async function () { - (await this.contract.shares.call(payee1)).should.be.bignumber.not.eq(0); + (await this.contract.shares.call(payee1)).should.be.bignumber.not.equal(0); }); it('should not store shares if address is not payee', async function () { diff --git a/test/proposals/ERC1046/TokenMetadata.test.js b/test/proposals/ERC1046/TokenMetadata.test.js index 9a3499115..ef0a2ca3d 100644 --- a/test/proposals/ERC1046/TokenMetadata.test.js +++ b/test/proposals/ERC1046/TokenMetadata.test.js @@ -11,6 +11,6 @@ describe('ERC20WithMetadata', function () { }); it('responds with the metadata', async function () { - (await this.token.tokenURI()).should.eq(metadataURI); + (await this.token.tokenURI()).should.equal(metadataURI); }); }); diff --git a/test/token/ERC20/MintableToken.behavior.js b/test/token/ERC20/MintableToken.behavior.js index ccc8b464a..6a7af101e 100644 --- a/test/token/ERC20/MintableToken.behavior.js +++ b/test/token/ERC20/MintableToken.behavior.js @@ -20,7 +20,7 @@ function shouldBehaveLikeMintableToken (owner, minter, [anyone]) { describe('minting finished', function () { describe('when the token minting is not finished', function () { it('returns false', async function () { - (await this.token.mintingFinished()).should.be.false; + (await this.token.mintingFinished()).should.equal(false); }); }); @@ -30,7 +30,7 @@ function shouldBehaveLikeMintableToken (owner, minter, [anyone]) { }); it('returns true', async function () { - (await this.token.mintingFinished()).should.be.true; + (await this.token.mintingFinished()).should.equal(true); }); }); }); @@ -43,7 +43,7 @@ function shouldBehaveLikeMintableToken (owner, minter, [anyone]) { it('finishes token minting', async function () { await this.token.finishMinting({ from }); - (await this.token.mintingFinished()).should.be.true; + (await this.token.mintingFinished()).should.equal(true); }); it('emits a mint finished event', async function () { diff --git a/test/token/ERC20/PausableToken.test.js b/test/token/ERC20/PausableToken.test.js index ef3cded32..906bbab6e 100644 --- a/test/token/ERC20/PausableToken.test.js +++ b/test/token/ERC20/PausableToken.test.js @@ -13,7 +13,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) { describe('when the token is unpaused', function () { it('pauses the token', async function () { await this.token.pause({ from }); - (await this.token.paused()).should.be.true; + (await this.token.paused()).should.equal(true); }); it('emits a Pause event', async function () { @@ -55,7 +55,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) { it('unpauses the token', async function () { await this.token.unpause({ from }); - (await this.token.paused()).should.be.false; + (await this.token.paused()).should.equal(false); }); it('emits an Unpause event', async function () { @@ -87,18 +87,18 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) { describe('paused', function () { it('is not paused by default', async function () { - (await this.token.paused({ from })).should.be.false; + (await this.token.paused({ from })).should.equal(false); }); it('is paused after being paused', async function () { await this.token.pause({ from }); - (await this.token.paused({ from })).should.be.true; + (await this.token.paused({ from })).should.equal(true); }); it('is not paused after being paused and then unpaused', async function () { await this.token.pause({ from }); await this.token.unpause({ from }); - (await this.token.paused()).should.be.false; + (await this.token.paused()).should.equal(false); }); }); diff --git a/test/token/ERC20/RBACMintableToken.behavior.js b/test/token/ERC20/RBACMintableToken.behavior.js index 7ed720b47..57325728b 100644 --- a/test/token/ERC20/RBACMintableToken.behavior.js +++ b/test/token/ERC20/RBACMintableToken.behavior.js @@ -6,10 +6,10 @@ function shouldBehaveLikeRBACMintableToken (owner, [anyone]) { describe('handle roles', function () { it('owner can add and remove a minter role', async function () { await this.token.addMinter(anyone, { from: owner }); - (await this.token.hasRole(anyone, ROLE_MINTER)).should.be.true; + (await this.token.hasRole(anyone, ROLE_MINTER)).should.equal(true); await this.token.removeMinter(anyone, { from: owner }); - (await this.token.hasRole(anyone, ROLE_MINTER)).should.be.false; + (await this.token.hasRole(anyone, ROLE_MINTER)).should.equal(false); }); it('anyone can\'t add or remove a minter role', async function () { diff --git a/test/token/ERC721/ERC721BasicToken.behavior.js b/test/token/ERC721/ERC721BasicToken.behavior.js index 27c48dc22..096570cd2 100644 --- a/test/token/ERC721/ERC721BasicToken.behavior.js +++ b/test/token/ERC721/ERC721BasicToken.behavior.js @@ -439,7 +439,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) { it('approves the operator', async function () { await this.token.setApprovalForAll(operator, true, { from: sender }); - (await this.token.isApprovedForAll(sender, operator)).should.be.true; + (await this.token.isApprovedForAll(sender, operator)).should.equal(true); }); it('emits an approval event', async function () { @@ -449,7 +449,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) { logs[0].event.should.be.equal('ApprovalForAll'); logs[0].args._owner.should.be.equal(sender); logs[0].args._operator.should.be.equal(operator); - logs[0].args._approved.should.be.true; + logs[0].args._approved.should.equal(true); }); }); @@ -461,7 +461,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) { it('approves the operator', async function () { await this.token.setApprovalForAll(operator, true, { from: sender }); - (await this.token.isApprovedForAll(sender, operator)).should.be.true; + (await this.token.isApprovedForAll(sender, operator)).should.equal(true); }); it('emits an approval event', async function () { @@ -471,13 +471,13 @@ function shouldBehaveLikeERC721BasicToken (accounts) { logs[0].event.should.be.equal('ApprovalForAll'); logs[0].args._owner.should.be.equal(sender); logs[0].args._operator.should.be.equal(operator); - logs[0].args._approved.should.be.true; + logs[0].args._approved.should.equal(true); }); it('can unset the operator approval', async function () { await this.token.setApprovalForAll(operator, false, { from: sender }); - (await this.token.isApprovedForAll(sender, operator)).should.be.false; + (await this.token.isApprovedForAll(sender, operator)).should.equal(false); }); }); @@ -489,7 +489,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) { it('keeps the approval to the given address', async function () { await this.token.setApprovalForAll(operator, true, { from: sender }); - (await this.token.isApprovedForAll(sender, operator)).should.be.true; + (await this.token.isApprovedForAll(sender, operator)).should.equal(true); }); it('emits an approval event', async function () { @@ -499,7 +499,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) { logs[0].event.should.be.equal('ApprovalForAll'); logs[0].args._owner.should.be.equal(sender); logs[0].args._operator.should.be.equal(operator); - logs[0].args._approved.should.be.true; + logs[0].args._approved.should.equal(true); }); }); }); diff --git a/test/token/ERC721/ERC721Token.test.js b/test/token/ERC721/ERC721Token.test.js index 0752d9ddc..aa3056eb3 100644 --- a/test/token/ERC721/ERC721Token.test.js +++ b/test/token/ERC721/ERC721Token.test.js @@ -126,7 +126,7 @@ contract('ERC721Token', function (accounts) { it('can burn token with metadata', async function () { await this.token.setTokenURI(firstTokenId, sampleUri); await this.token.burn(firstTokenId); - (await this.token.exists(firstTokenId)).should.be.false; + (await this.token.exists(firstTokenId)).should.equal(false); }); it('returns empty metadata for token', async function () {