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.
pull/1233/head
Nicolás Venturo 7 years ago committed by GitHub
parent 64c324e37c
commit 4fb9bb7020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 5
      test/.eslintrc
  3. 2
      test/Bounty.test.js
  4. 24
      test/Heritable.test.js
  5. 32
      test/access/SignatureBouncer.test.js
  6. 4
      test/crowdsale/AllowanceCrowdsale.test.js
  7. 6
      test/crowdsale/CappedCrowdsale.test.js
  8. 8
      test/crowdsale/Crowdsale.test.js
  9. 4
      test/crowdsale/MintedCrowdsale.behavior.js
  10. 4
      test/crowdsale/MintedCrowdsale.test.js
  11. 4
      test/crowdsale/TimedCrowdsale.test.js
  12. 10
      test/crowdsale/WhitelistedCrowdsale.test.js
  13. 6
      test/examples/SampleCrowdsale.test.js
  14. 6
      test/examples/SimpleToken.test.js
  15. 2
      test/helpers/expectEvent.js
  16. 2
      test/introspection/SupportsInterface.behavior.js
  17. 10
      test/library/ECRecovery.test.js
  18. 6
      test/library/MerkleProof.test.js
  19. 6
      test/lifecycle/Pausable.test.js
  20. 6
      test/ownership/Claimable.test.js
  21. 4
      test/ownership/Contactable.test.js
  22. 8
      test/ownership/DelayedClaimable.test.js
  23. 2
      test/ownership/HasNoContracts.test.js
  24. 6
      test/ownership/Ownable.behavior.js
  25. 6
      test/ownership/Superuser.test.js
  26. 8
      test/ownership/Whitelist.test.js
  27. 2
      test/payment/SplitPayment.test.js
  28. 2
      test/proposals/ERC1046/TokenMetadata.test.js
  29. 6
      test/token/ERC20/MintableToken.behavior.js
  30. 10
      test/token/ERC20/PausableToken.test.js
  31. 4
      test/token/ERC20/RBACMintableToken.behavior.js
  32. 14
      test/token/ERC721/ERC721BasicToken.behavior.js
  33. 2
      test/token/ERC721/ERC721Token.test.js

@ -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.

@ -1,5 +0,0 @@
{
"rules": {
"no-unused-expressions": 0
}
}

@ -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);

@ -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 () {

@ -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);
}
);
});

@ -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);
});

@ -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);
});
});
});

@ -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);
});

@ -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);
});

@ -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);

@ -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 () {

@ -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);
});
});
});

@ -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);

@ -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);

@ -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;
}

@ -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);
});
});
}

@ -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));
});
});
});

@ -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);
});
});
});

@ -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);
});
});

@ -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);
});
});
});

@ -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);
});
});
});

@ -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 () {

@ -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 () {

@ -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 () {

@ -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 () {

@ -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);
}
});

@ -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 () {

@ -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);
});
});

@ -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 () {

@ -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);
});
});

@ -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 () {

@ -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);
});
});
});

@ -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 () {

Loading…
Cancel
Save