Browse Source

All tests now use account names, and dont use accounts[0] (except ERC… (#1137)

* All tests now use account names, and dont use accounts[0] (except ERC721)

* Added account names to some missing contracts.
Nicolás Venturo 7 years ago
parent
commit
4544df47da
41 changed files with 211 additions and 301 deletions
  1. 10 25
      test/Heritable.test.js
  2. 1 1
      test/LimitBalance.test.js
  3. 1 1
      test/ReentrancyGuard.test.js
  4. 8 9
      test/SimpleSavingsWallet.test.js
  5. 4 3
      test/examples/SampleCrowdsale.test.js
  6. 1 2
      test/examples/SimpleToken.test.js
  7. 1 1
      test/introspection/SupportsInterfaceWithLookup.test.js
  8. 6 6
      test/library/ECRecovery.test.js
  9. 1 1
      test/library/Math.test.js
  10. 1 1
      test/library/MerkleProof.test.js
  11. 9 11
      test/lifecycle/Destructible.test.js
  12. 1 1
      test/lifecycle/Pausable.test.js
  13. 2 5
      test/lifecycle/TokenDestructible.test.js
  14. 8 8
      test/ownership/CanReclaimToken.test.js
  15. 5 20
      test/ownership/Claimable.test.js
  16. 1 1
      test/ownership/Contactable.test.js
  17. 16 20
      test/ownership/DelayedClaimable.test.js
  18. 7 10
      test/ownership/HasNoContracts.test.js
  19. 23 23
      test/ownership/HasNoEther.test.js
  20. 8 8
      test/ownership/HasNoTokens.test.js
  21. 9 22
      test/ownership/Ownable.behaviour.js
  22. 3 3
      test/ownership/Ownable.test.js
  23. 2 9
      test/ownership/Superuser.test.js
  24. 2 9
      test/ownership/Whitelist.test.js
  25. 9 18
      test/ownership/rbac/RBAC.test.js
  26. 3 6
      test/payment/ConditionalEscrow.test.js
  27. 2 4
      test/payment/Escrow.test.js
  28. 20 21
      test/payment/PullPayment.test.js
  29. 2 2
      test/payment/RefundEscrow.test.js
  30. 1 1
      test/payment/SplitPayment.test.js
  31. 4 6
      test/token/ERC20/BurnableToken.behaviour.js
  32. 3 3
      test/token/ERC20/BurnableToken.test.js
  33. 6 6
      test/token/ERC20/CappedToken.behaviour.js
  34. 5 6
      test/token/ERC20/CappedToken.test.js
  35. 1 1
      test/token/ERC20/DetailedERC20.test.js
  36. 3 3
      test/token/ERC20/MintableToken.behaviour.js
  37. 2 4
      test/token/ERC20/MintableToken.test.js
  38. 6 6
      test/token/ERC20/RBACCappedToken.test.js
  39. 9 9
      test/token/ERC20/RBACMintableToken.behaviour.js
  40. 3 3
      test/token/ERC20/RBACMintableToken.test.js
  41. 2 2
      test/token/ERC20/StandardBurnableToken.test.js

+ 10 - 25
test/Heritable.test.js

@@ -6,13 +6,11 @@ const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
 
 const Heritable = artifacts.require('Heritable');
 
-contract('Heritable', function (accounts) {
+contract('Heritable', function ([_, owner, heir, anyone]) {
   let heritable;
-  let owner;
 
   beforeEach(async function () {
-    heritable = await Heritable.new(4141);
-    owner = await heritable.owner();
+    heritable = await Heritable.new(4141, { from: owner });
   });
 
   it('should start off with an owner, but without heir', async function () {
@@ -31,12 +29,8 @@ contract('Heritable', function (accounts) {
   });
 
   it('only owner should set heir', async function () {
-    const newHeir = accounts[1];
-    const someRandomAddress = accounts[2];
-    assert.isTrue(owner !== someRandomAddress);
-
-    await heritable.setHeir(newHeir, { from: owner });
-    await expectThrow(heritable.setHeir(newHeir, { from: someRandomAddress }));
+    await heritable.setHeir(heir, { from: owner });
+    await expectThrow(heritable.setHeir(heir, { from: anyone }));
   });
 
   it('owner can\'t be heir', async function () {
@@ -44,18 +38,14 @@ contract('Heritable', function (accounts) {
   });
 
   it('owner can remove heir', async function () {
-    const newHeir = accounts[1];
-    await heritable.setHeir(newHeir, { from: owner });
-    let heir = await heritable.heir();
-
-    assert.notStrictEqual(heir, NULL_ADDRESS);
-    await heritable.removeHeir();
-    heir = await heritable.heir();
-    assert.isTrue(heir === NULL_ADDRESS);
+    await heritable.setHeir(heir, { from: owner });
+    assert.equal(await heritable.heir(), heir);
+
+    await heritable.removeHeir({ from: owner });
+    assert.equal(await heritable.heir(), NULL_ADDRESS);
   });
 
   it('heir can claim ownership only if owner is dead and timeout was reached', async function () {
-    const heir = accounts[1];
     await heritable.setHeir(heir, { from: owner });
     await expectThrow(heritable.claimHeirOwnership({ from: heir }));
 
@@ -69,20 +59,17 @@ contract('Heritable', function (accounts) {
   });
 
   it('only heir can proclaim death', async function () {
-    const someRandomAddress = accounts[2];
     await assertRevert(heritable.proclaimDeath({ from: owner }));
-    await assertRevert(heritable.proclaimDeath({ from: someRandomAddress }));
+    await assertRevert(heritable.proclaimDeath({ from: anyone }));
   });
 
   it('heir can\'t proclaim death if owner is death', async function () {
-    const heir = accounts[1];
     await heritable.setHeir(heir, { from: owner });
     await heritable.proclaimDeath({ from: heir });
     await assertRevert(heritable.proclaimDeath({ from: heir }));
   });
 
   it('heir can\'t claim ownership if owner heartbeats', async function () {
-    const heir = accounts[1];
     await heritable.setHeir(heir, { from: owner });
 
     await heritable.proclaimDeath({ from: heir });
@@ -96,8 +83,6 @@ contract('Heritable', function (accounts) {
   });
 
   it('should log events appropriately', async function () {
-    const heir = accounts[1];
-
     const setHeirLogs = (await heritable.setHeir(heir, { from: owner })).logs;
     const setHeirEvent = setHeirLogs.find(e => e.event === 'HeirChanged');
 

+ 1 - 1
test/LimitBalance.test.js

@@ -3,7 +3,7 @@ const { ethGetBalance } = require('./helpers/web3');
 
 const LimitBalanceMock = artifacts.require('LimitBalanceMock');
 
-contract('LimitBalance', function (accounts) {
+contract('LimitBalance', function () {
   let limitBalance;
 
   beforeEach(async function () {

+ 1 - 1
test/ReentrancyGuard.test.js

@@ -2,7 +2,7 @@ const { expectThrow } = require('./helpers/expectThrow');
 const ReentrancyMock = artifacts.require('ReentrancyMock');
 const ReentrancyAttack = artifacts.require('ReentrancyAttack');
 
-contract('ReentrancyGuard', function (accounts) {
+contract('ReentrancyGuard', function () {
   let reentrancyMock;
 
   beforeEach(async function () {

+ 8 - 9
test/SimpleSavingsWallet.test.js

@@ -3,15 +3,13 @@ const { ethGetBalance, ethSendTransaction } = require('./helpers/web3');
 
 const SimpleSavingsWallet = artifacts.require('SimpleSavingsWallet');
 
-contract('SimpleSavingsWallet', function (accounts) {
+contract('SimpleSavingsWallet', function ([_, owner, anyone]) {
   let savingsWallet;
-  let owner;
 
   const paymentAmount = 4242;
 
   beforeEach(async function () {
-    savingsWallet = await SimpleSavingsWallet.new(4141);
-    owner = await savingsWallet.owner();
+    savingsWallet = await SimpleSavingsWallet.new(4141, { from: owner });
   });
 
   it('should receive funds', async function () {
@@ -22,14 +20,15 @@ contract('SimpleSavingsWallet', function (accounts) {
 
   it('owner can send funds', async function () {
     // Receive payment so we have some money to spend.
-    await ethSendTransaction({ from: accounts[9], to: savingsWallet.address, value: 1000000 });
+    await ethSendTransaction({ from: anyone, to: savingsWallet.address, value: 1000000 });
+
     await expectThrow(savingsWallet.sendTo(0, paymentAmount, { from: owner }));
     await expectThrow(savingsWallet.sendTo(savingsWallet.address, paymentAmount, { from: owner }));
-    await expectThrow(savingsWallet.sendTo(accounts[1], 0, { from: owner }));
+    await expectThrow(savingsWallet.sendTo(anyone, 0, { from: owner }));
 
-    const balance = await ethGetBalance(accounts[1]);
-    await savingsWallet.sendTo(accounts[1], paymentAmount, { from: owner });
-    const updatedBalance = await ethGetBalance(accounts[1]);
+    const balance = await ethGetBalance(anyone);
+    await savingsWallet.sendTo(anyone, paymentAmount, { from: owner });
+    const updatedBalance = await ethGetBalance(anyone);
     assert.isTrue(balance.plus(paymentAmount).equals(updatedBalance));
   });
 });

+ 4 - 3
test/examples/SampleCrowdsale.test.js

@@ -16,7 +16,7 @@ require('chai')
 const SampleCrowdsale = artifacts.require('SampleCrowdsale');
 const SampleCrowdsaleToken = artifacts.require('SampleCrowdsaleToken');
 
-contract('SampleCrowdsale', function ([owner, wallet, investor]) {
+contract('SampleCrowdsale', function ([_, owner, wallet, investor]) {
   const RATE = new BigNumber(10);
   const GOAL = ether(10);
   const CAP = ether(20);
@@ -33,9 +33,10 @@ contract('SampleCrowdsale', function ([owner, wallet, investor]) {
 
     this.token = await SampleCrowdsaleToken.new({ from: owner });
     this.crowdsale = await SampleCrowdsale.new(
-      this.openingTime, this.closingTime, RATE, wallet, CAP, this.token.address, GOAL
+      this.openingTime, this.closingTime, RATE, wallet, CAP, this.token.address, GOAL,
+      { from: owner }
     );
-    await this.token.transferOwnership(this.crowdsale.address);
+    await this.token.transferOwnership(this.crowdsale.address, { from: owner });
   });
 
   it('should create crowdsale with correct parameters', async function () {

+ 1 - 2
test/examples/SimpleToken.test.js

@@ -1,9 +1,8 @@
 const { decodeLogs } = require('../helpers/decodeLogs');
 const SimpleToken = artifacts.require('SimpleToken');
 
-contract('SimpleToken', accounts => {
+contract('SimpleToken', function ([_, creator]) {
   let token;
-  const creator = accounts[0];
 
   beforeEach(async function () {
     token = await SimpleToken.new({ from: creator });

+ 1 - 1
test/introspection/SupportsInterfaceWithLookup.test.js

@@ -6,7 +6,7 @@ const SupportsInterfaceWithLookup = artifacts.require('SupportsInterfaceWithLook
 require('chai')
   .should();
 
-contract('SupportsInterfaceWithLookup', function (accounts) {
+contract('SupportsInterfaceWithLookup', function () {
   beforeEach(async function () {
     this.mock = await SupportsInterfaceWithLookup.new();
   });

+ 6 - 6
test/library/ECRecovery.test.js

@@ -6,7 +6,7 @@ const ECRecoveryMock = artifacts.require('ECRecoveryMock');
 require('chai')
   .should();
 
-contract('ECRecovery', function (accounts) {
+contract('ECRecovery', function ([_, anyone]) {
   let ecrecovery;
   const TEST_MESSAGE = 'OpenZeppelin';
 
@@ -36,28 +36,28 @@ contract('ECRecovery', function (accounts) {
 
   it('recover using web3.eth.sign()', async function () {
     // Create the signature using account[0]
-    const signature = signMessage(accounts[0], web3.sha3(TEST_MESSAGE));
+    const signature = signMessage(anyone, web3.sha3(TEST_MESSAGE));
 
     // Recover the signer address from the generated message and signature.
     const addrRecovered = await ecrecovery.recover(
       hashMessage(TEST_MESSAGE),
       signature
     );
-    addrRecovered.should.eq(accounts[0]);
+    addrRecovered.should.eq(anyone);
   });
 
   it('recover using web3.eth.sign() should return wrong signer', async function () {
     // Create the signature using account[0]
-    const signature = signMessage(accounts[0], web3.sha3(TEST_MESSAGE));
+    const signature = signMessage(anyone, web3.sha3(TEST_MESSAGE));
 
     // Recover the signer address from the generated message and wrong signature.
     const addrRecovered = await ecrecovery.recover(hashMessage('Nope'), signature);
-    assert.notEqual(accounts[0], addrRecovered);
+    assert.notEqual(anyone, addrRecovered);
   });
 
   it('recover should revert when a small hash is sent', async function () {
     // Create the signature using account[0]
-    const signature = signMessage(accounts[0], TEST_MESSAGE);
+    const signature = signMessage(anyone, TEST_MESSAGE);
     try {
       await expectThrow(
         ecrecovery.recover(hashMessage(TEST_MESSAGE).substring(2), signature)

+ 1 - 1
test/library/Math.test.js

@@ -1,6 +1,6 @@
 const MathMock = artifacts.require('MathMock');
 
-contract('Math', function (accounts) {
+contract('Math', function () {
   let math;
 
   beforeEach(async function () {

+ 1 - 1
test/library/MerkleProof.test.js

@@ -3,7 +3,7 @@ const { sha3, bufferToHex } = require('ethereumjs-util');
 
 const MerkleProofWrapper = artifacts.require('MerkleProofWrapper');
 
-contract('MerkleProof', function (accounts) {
+contract('MerkleProof', function () {
   let merkleProof;
 
   beforeEach(async function () {

+ 9 - 11
test/lifecycle/Destructible.test.js

@@ -1,29 +1,27 @@
 const DestructibleMock = artifacts.require('DestructibleMock');
 const { ethGetBalance } = require('../helpers/web3');
 
-contract('Destructible', function (accounts) {
+contract('Destructible', function ([_, owner, recipient]) {
   beforeEach(async function () {
-    this.destructible = await DestructibleMock.new({ from: accounts[0] });
+    this.destructible = await DestructibleMock.new({ from: owner });
     await web3.eth.sendTransaction({
-      from: accounts[0],
+      from: owner,
       to: this.destructible.address,
       value: web3.toWei('10', 'ether'),
     });
-
-    this.owner = await this.destructible.owner();
   });
 
   it('should send balance to owner after destruction', async function () {
-    const initBalance = await ethGetBalance(this.owner);
-    await this.destructible.destroy({ from: this.owner });
-    const newBalance = await ethGetBalance(this.owner);
+    const initBalance = await ethGetBalance(owner);
+    await this.destructible.destroy({ from: owner });
+    const newBalance = await ethGetBalance(owner);
     assert.isTrue(newBalance > initBalance);
   });
 
   it('should send balance to recepient after destruction', async function () {
-    const initBalance = await ethGetBalance(accounts[1]);
-    await this.destructible.destroyAndSend(accounts[1], { from: this.owner });
-    const newBalance = await ethGetBalance(accounts[1]);
+    const initBalance = await ethGetBalance(recipient);
+    await this.destructible.destroyAndSend(recipient, { from: owner });
+    const newBalance = await ethGetBalance(recipient);
     assert.isTrue(newBalance.greaterThan(initBalance));
   });
 });

+ 1 - 1
test/lifecycle/Pausable.test.js

@@ -1,7 +1,7 @@
 const { assertRevert } = require('../helpers/assertRevert');
 const PausableMock = artifacts.require('PausableMock');
 
-contract('Pausable', function (accounts) {
+contract('Pausable', function () {
   beforeEach(async function () {
     this.Pausable = await PausableMock.new();
   });

+ 2 - 5
test/lifecycle/TokenDestructible.test.js

@@ -3,17 +3,14 @@ const { ethGetBalance } = require('../helpers/web3');
 const TokenDestructible = artifacts.require('TokenDestructible');
 const StandardTokenMock = artifacts.require('StandardTokenMock');
 
-contract('TokenDestructible', function (accounts) {
+contract('TokenDestructible', function ([_, owner]) {
   let tokenDestructible;
-  let owner;
 
   beforeEach(async function () {
     tokenDestructible = await TokenDestructible.new({
-      from: accounts[0],
+      from: owner,
       value: web3.toWei('10', 'ether'),
     });
-
-    owner = await tokenDestructible.owner();
   });
 
   it('should send balance to owner after destruction', async function () {

+ 8 - 8
test/ownership/CanReclaimToken.test.js

@@ -3,24 +3,24 @@ const { expectThrow } = require('../helpers/expectThrow');
 const CanReclaimToken = artifacts.require('CanReclaimToken');
 const BasicTokenMock = artifacts.require('BasicTokenMock');
 
-contract('CanReclaimToken', function (accounts) {
+contract('CanReclaimToken', function ([_, owner, anyone]) {
   let token = null;
   let canReclaimToken = null;
 
   beforeEach(async function () {
     // Create contract and token
-    token = await BasicTokenMock.new(accounts[0], 100);
-    canReclaimToken = await CanReclaimToken.new();
+    token = await BasicTokenMock.new(owner, 100, { from: owner });
+    canReclaimToken = await CanReclaimToken.new({ from: owner });
     // Force token into contract
-    await token.transfer(canReclaimToken.address, 10);
+    await token.transfer(canReclaimToken.address, 10, { from: owner });
     const startBalance = await token.balanceOf(canReclaimToken.address);
     assert.equal(startBalance, 10);
   });
 
   it('should allow owner to reclaim tokens', async function () {
-    const ownerStartBalance = await token.balanceOf(accounts[0]);
-    await canReclaimToken.reclaimToken(token.address);
-    const ownerFinalBalance = await token.balanceOf(accounts[0]);
+    const ownerStartBalance = await token.balanceOf(owner);
+    await canReclaimToken.reclaimToken(token.address, { from: owner });
+    const ownerFinalBalance = await token.balanceOf(owner);
     const finalBalance = await token.balanceOf(canReclaimToken.address);
     assert.equal(finalBalance, 0);
     assert.equal(ownerFinalBalance - ownerStartBalance, 10);
@@ -28,7 +28,7 @@ contract('CanReclaimToken', function (accounts) {
 
   it('should allow only owner to reclaim tokens', async function () {
     await expectThrow(
-      canReclaimToken.reclaimToken(token.address, { from: accounts[1] }),
+      canReclaimToken.reclaimToken(token.address, { from: anyone })
     );
   });
 });

+ 5 - 20
test/ownership/Claimable.test.js

@@ -2,51 +2,36 @@ const { assertRevert } = require('../helpers/assertRevert');
 
 const Claimable = artifacts.require('Claimable');
 
-contract('Claimable', function (accounts) {
+contract('Claimable', function ([_, owner, newOwner, anyone]) {
   let claimable;
 
   beforeEach(async function () {
     claimable = await Claimable.new();
   });
 
-  it('should have an owner', async function () {
-    const owner = await claimable.owner();
-    assert.isTrue(owner !== 0);
-  });
-
   it('changes pendingOwner after transfer', async function () {
-    const newOwner = accounts[1];
     await claimable.transferOwnership(newOwner);
     const pendingOwner = await claimable.pendingOwner();
 
     assert.isTrue(pendingOwner === newOwner);
   });
 
-  it('should prevent to claimOwnership from no pendingOwner', async function () {
-    await assertRevert(claimable.claimOwnership({ from: accounts[2] }));
+  it('should prevent to claimOwnership from anyone', async function () {
+    await assertRevert(claimable.claimOwnership({ from: anyone }));
   });
 
   it('should prevent non-owners from transfering', async function () {
-    const other = accounts[2];
-    const owner = await claimable.owner.call();
-
-    assert.isTrue(owner !== other);
-    await assertRevert(claimable.transferOwnership(other, { from: other }));
+    await assertRevert(claimable.transferOwnership(anyone, { from: anyone }));
   });
 
   describe('after initiating a transfer', function () {
-    let newOwner;
-
     beforeEach(async function () {
-      newOwner = accounts[1];
       await claimable.transferOwnership(newOwner);
     });
 
     it('changes allow pending owner to claim ownership', async function () {
       await claimable.claimOwnership({ from: newOwner });
-      const owner = await claimable.owner();
-
-      assert.isTrue(owner === newOwner);
+      assert.isTrue((await claimable.owner()) === newOwner);
     });
   });
 });

+ 1 - 1
test/ownership/Contactable.test.js

@@ -1,6 +1,6 @@
 const Contactable = artifacts.require('Contactable');
 
-contract('Contactable', function (accounts) {
+contract('Contactable', function () {
   let contactable;
 
   beforeEach(async function () {

+ 16 - 20
test/ownership/DelayedClaimable.test.js

@@ -2,14 +2,14 @@ const { assertRevert } = require('../helpers/assertRevert');
 
 const DelayedClaimable = artifacts.require('DelayedClaimable');
 
-contract('DelayedClaimable', function (accounts) {
+contract('DelayedClaimable', function ([_, owner, newOwner]) {
   beforeEach(async function () {
-    this.delayedClaimable = await DelayedClaimable.new();
+    this.delayedClaimable = await DelayedClaimable.new({ from: owner });
   });
 
   it('can set claim blocks', async function () {
-    await this.delayedClaimable.transferOwnership(accounts[2]);
-    await this.delayedClaimable.setLimits(0, 1000);
+    await this.delayedClaimable.transferOwnership(newOwner, { from: owner });
+    await this.delayedClaimable.setLimits(0, 1000, { from: owner });
     const end = await this.delayedClaimable.end();
     assert.equal(end, 1000);
     const start = await this.delayedClaimable.start();
@@ -17,35 +17,31 @@ contract('DelayedClaimable', function (accounts) {
   });
 
   it('changes pendingOwner after transfer successful', async function () {
-    await this.delayedClaimable.transferOwnership(accounts[2]);
-    await this.delayedClaimable.setLimits(0, 1000);
+    await this.delayedClaimable.transferOwnership(newOwner, { from: owner });
+    await this.delayedClaimable.setLimits(0, 1000, { from: owner });
     const end = await this.delayedClaimable.end();
     assert.equal(end, 1000);
     const start = await this.delayedClaimable.start();
     assert.equal(start, 0);
-    const pendingOwner = await this.delayedClaimable.pendingOwner();
-    assert.equal(pendingOwner, accounts[2]);
-    await this.delayedClaimable.claimOwnership({ from: accounts[2] });
-    const owner = await this.delayedClaimable.owner();
-    assert.equal(owner, accounts[2]);
+    assert.equal((await this.delayedClaimable.pendingOwner()), newOwner);
+    await this.delayedClaimable.claimOwnership({ from: newOwner });
+    assert.equal((await this.delayedClaimable.owner()), newOwner);
   });
 
   it('changes pendingOwner after transfer fails', async function () {
-    await this.delayedClaimable.transferOwnership(accounts[1]);
-    await this.delayedClaimable.setLimits(100, 110);
+    await this.delayedClaimable.transferOwnership(newOwner, { from: owner });
+    await this.delayedClaimable.setLimits(100, 110, { from: owner });
     const end = await this.delayedClaimable.end();
     assert.equal(end, 110);
     const start = await this.delayedClaimable.start();
     assert.equal(start, 100);
-    const pendingOwner = await this.delayedClaimable.pendingOwner();
-    assert.equal(pendingOwner, accounts[1]);
-    await assertRevert(this.delayedClaimable.claimOwnership({ from: accounts[1] }));
-    const owner = await this.delayedClaimable.owner();
-    assert.isTrue(owner !== accounts[1]);
+    assert.equal((await this.delayedClaimable.pendingOwner()), newOwner);
+    await assertRevert(this.delayedClaimable.claimOwnership({ from: newOwner }));
+    assert.isTrue((await this.delayedClaimable.owner()) !== newOwner);
   });
 
   it('set end and start invalid values fail', async function () {
-    await this.delayedClaimable.transferOwnership(accounts[1]);
-    await assertRevert(this.delayedClaimable.setLimits(1001, 1000));
+    await this.delayedClaimable.transferOwnership(newOwner, { from: owner });
+    await assertRevert(this.delayedClaimable.setLimits(1001, 1000, { from: owner }));
   });
 });

+ 7 - 10
test/ownership/HasNoContracts.test.js

@@ -3,30 +3,27 @@ const { expectThrow } = require('../helpers/expectThrow');
 const Ownable = artifacts.require('Ownable');
 const HasNoContracts = artifacts.require('HasNoContracts');
 
-contract('HasNoContracts', function (accounts) {
+contract('HasNoContracts', function ([_, owner, anyone]) {
   let hasNoContracts = null;
   let ownable = null;
 
   beforeEach(async () => {
     // Create contract and token
-    hasNoContracts = await HasNoContracts.new();
-    ownable = await Ownable.new();
+    hasNoContracts = await HasNoContracts.new({ from: owner });
+    ownable = await Ownable.new({ from: owner });
 
     // Force ownership into contract
-    await ownable.transferOwnership(hasNoContracts.address);
-    const owner = await ownable.owner();
-    assert.equal(owner, hasNoContracts.address);
+    await ownable.transferOwnership(hasNoContracts.address, { from: owner });
   });
 
   it('should allow owner to reclaim contracts', async function () {
-    await hasNoContracts.reclaimContract(ownable.address);
-    const owner = await ownable.owner();
-    assert.equal(owner, accounts[0]);
+    await hasNoContracts.reclaimContract(ownable.address, { from: owner });
+    assert.equal((await ownable.owner()), owner);
   });
 
   it('should allow only owner to reclaim contracts', async function () {
     await expectThrow(
-      hasNoContracts.reclaimContract(ownable.address, { from: accounts[1] }),
+      hasNoContracts.reclaimContract(ownable.address, { from: anyone })
     );
   });
 });

+ 23 - 23
test/ownership/HasNoEther.test.js

@@ -4,11 +4,17 @@ const { ethSendTransaction, ethGetBalance } = require('../helpers/web3');
 const HasNoEtherTest = artifacts.require('HasNoEtherTest');
 const ForceEther = artifacts.require('ForceEther');
 
-contract('HasNoEther', function (accounts) {
+const BigNumber = web3.BigNumber;
+
+require('chai')
+  .use(require('chai-bignumber')(BigNumber))
+  .should();
+
+contract('HasNoEther', function ([_, owner, anyone]) {
   const amount = web3.toWei('1', 'ether');
 
-  it('should be constructible', async function () {
-    await HasNoEtherTest.new();
+  beforeEach(async function () {
+    this.hasNoEther = await HasNoEtherTest.new({ from: owner });
   });
 
   it('should not accept ether in constructor', async function () {
@@ -16,49 +22,43 @@ contract('HasNoEther', function (accounts) {
   });
 
   it('should not accept ether', async function () {
-    const hasNoEther = await HasNoEtherTest.new();
-
     await expectThrow(
       ethSendTransaction({
-        from: accounts[1],
-        to: hasNoEther.address,
+        from: owner,
+        to: this.hasNoEther.address,
         value: amount,
       }),
     );
   });
 
   it('should allow owner to reclaim ether', async function () {
-    // Create contract
-    const hasNoEther = await HasNoEtherTest.new();
-    const startBalance = await ethGetBalance(hasNoEther.address);
+    const startBalance = await ethGetBalance(this.hasNoEther.address);
     assert.equal(startBalance, 0);
 
     // Force ether into it
     const forceEther = await ForceEther.new({ value: amount });
-    await forceEther.destroyAndSend(hasNoEther.address);
-    const forcedBalance = await ethGetBalance(hasNoEther.address);
+    await forceEther.destroyAndSend(this.hasNoEther.address);
+    const forcedBalance = await ethGetBalance(this.hasNoEther.address);
     assert.equal(forcedBalance, amount);
 
     // Reclaim
-    const ownerStartBalance = await ethGetBalance(accounts[0]);
-    await hasNoEther.reclaimEther();
-    const ownerFinalBalance = await ethGetBalance(accounts[0]);
-    const finalBalance = await ethGetBalance(hasNoEther.address);
+    const ownerStartBalance = await ethGetBalance(owner);
+    await this.hasNoEther.reclaimEther({ from: owner });
+    const ownerFinalBalance = await ethGetBalance(owner);
+    const finalBalance = await ethGetBalance(this.hasNoEther.address);
     assert.equal(finalBalance, 0);
-    assert.isTrue(ownerFinalBalance.greaterThan(ownerStartBalance));
+
+    ownerFinalBalance.should.be.bignumber.gt(ownerStartBalance);
   });
 
   it('should allow only owner to reclaim ether', async function () {
-    // Create contract
-    const hasNoEther = await HasNoEtherTest.new({ from: accounts[0] });
-
     // Force ether into it
     const forceEther = await ForceEther.new({ value: amount });
-    await forceEther.destroyAndSend(hasNoEther.address);
-    const forcedBalance = await ethGetBalance(hasNoEther.address);
+    await forceEther.destroyAndSend(this.hasNoEther.address);
+    const forcedBalance = await ethGetBalance(this.hasNoEther.address);
     assert.equal(forcedBalance, amount);
 
     // Reclaim
-    await expectThrow(hasNoEther.reclaimEther({ from: accounts[1] }));
+    await expectThrow(this.hasNoEther.reclaimEther({ from: anyone }));
   });
 });

+ 8 - 8
test/ownership/HasNoTokens.test.js

@@ -3,17 +3,17 @@ const { expectThrow } = require('../helpers/expectThrow');
 const HasNoTokens = artifacts.require('HasNoTokens');
 const ERC223TokenMock = artifacts.require('ERC223TokenMock');
 
-contract('HasNoTokens', function (accounts) {
+contract('HasNoTokens', function ([_, owner, initialAccount, anyone]) {
   let hasNoTokens = null;
   let token = null;
 
   beforeEach(async () => {
     // Create contract and token
-    hasNoTokens = await HasNoTokens.new();
-    token = await ERC223TokenMock.new(accounts[0], 100);
+    hasNoTokens = await HasNoTokens.new({ from: owner });
+    token = await ERC223TokenMock.new(initialAccount, 100);
 
     // Force token into contract
-    await token.transfer(hasNoTokens.address, 10);
+    await token.transfer(hasNoTokens.address, 10, { from: initialAccount });
     const startBalance = await token.balanceOf(hasNoTokens.address);
     assert.equal(startBalance, 10);
   });
@@ -23,9 +23,9 @@ contract('HasNoTokens', function (accounts) {
   });
 
   it('should allow owner to reclaim tokens', async function () {
-    const ownerStartBalance = await token.balanceOf(accounts[0]);
-    await hasNoTokens.reclaimToken(token.address);
-    const ownerFinalBalance = await token.balanceOf(accounts[0]);
+    const ownerStartBalance = await token.balanceOf(owner);
+    await hasNoTokens.reclaimToken(token.address, { from: owner });
+    const ownerFinalBalance = await token.balanceOf(owner);
     const finalBalance = await token.balanceOf(hasNoTokens.address);
     assert.equal(finalBalance, 0);
     assert.equal(ownerFinalBalance - ownerStartBalance, 10);
@@ -33,7 +33,7 @@ contract('HasNoTokens', function (accounts) {
 
   it('should allow only owner to reclaim tokens', async function () {
     await expectThrow(
-      hasNoTokens.reclaimToken(token.address, { from: accounts[1] }),
+      hasNoTokens.reclaimToken(token.address, { from: anyone })
     );
   });
 });

+ 9 - 22
test/ownership/Ownable.behaviour.js

@@ -6,45 +6,32 @@ const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
 require('chai')
   .should();
 
-function shouldBehaveLikeOwnable (accounts) {
+function shouldBehaveLikeOwnable (owner, [anyone]) {
   describe('as an ownable', function () {
     it('should have an owner', async function () {
-      const owner = await this.ownable.owner();
-      owner.should.not.eq(ZERO_ADDRESS);
+      (await this.ownable.owner()).should.eq(owner);
     });
 
     it('changes owner after transfer', async function () {
-      const other = accounts[1];
-      await this.ownable.transferOwnership(other);
-      const owner = await this.ownable.owner();
-
-      owner.should.eq(other);
+      await this.ownable.transferOwnership(anyone, { from: owner });
+      (await this.ownable.owner()).should.eq(anyone);
     });
 
     it('should prevent non-owners from transfering', async function () {
-      const other = accounts[2];
-      const owner = await this.ownable.owner.call();
-      owner.should.not.eq(other);
-      await expectThrow(this.ownable.transferOwnership(other, { from: other }), EVMRevert);
+      await expectThrow(this.ownable.transferOwnership(anyone, { from: anyone }), EVMRevert);
     });
 
     it('should guard ownership against stuck state', async function () {
-      const originalOwner = await this.ownable.owner();
-      await expectThrow(this.ownable.transferOwnership(null, { from: originalOwner }), EVMRevert);
+      await expectThrow(this.ownable.transferOwnership(null, { from: owner }), EVMRevert);
     });
 
     it('loses owner after renouncement', async function () {
-      await this.ownable.renounceOwnership();
-      const owner = await this.ownable.owner();
-
-      owner.should.eq(ZERO_ADDRESS);
+      await this.ownable.renounceOwnership({ from: owner });
+      (await this.ownable.owner()).should.eq(ZERO_ADDRESS);
     });
 
     it('should prevent non-owners from renouncement', async function () {
-      const other = accounts[2];
-      const owner = await this.ownable.owner.call();
-      owner.should.not.eq(other);
-      await expectThrow(this.ownable.renounceOwnership({ from: other }), EVMRevert);
+      await expectThrow(this.ownable.renounceOwnership({ from: anyone }), EVMRevert);
     });
   });
 }

+ 3 - 3
test/ownership/Ownable.test.js

@@ -2,10 +2,10 @@ const { shouldBehaveLikeOwnable } = require('./Ownable.behaviour');
 
 const Ownable = artifacts.require('Ownable');
 
-contract('Ownable', function (accounts) {
+contract('Ownable', function ([_, owner, ...otherAccounts]) {
   beforeEach(async function () {
-    this.ownable = await Ownable.new();
+    this.ownable = await Ownable.new({ from: owner });
   });
 
-  shouldBehaveLikeOwnable(accounts);
+  shouldBehaveLikeOwnable(owner, otherAccounts);
 });

+ 2 - 9
test/ownership/Superuser.test.js

@@ -6,16 +6,9 @@ const Superuser = artifacts.require('Superuser');
 require('chai')
   .should();
 
-contract('Superuser', function (accounts) {
-  const [
-    firstOwner,
-    newSuperuser,
-    newOwner,
-    anyone,
-  ] = accounts;
-
+contract('Superuser', function ([_, firstOwner, newSuperuser, newOwner, anyone]) {
   beforeEach(async function () {
-    this.superuser = await Superuser.new();
+    this.superuser = await Superuser.new({ from: firstOwner });
   });
 
   context('in normal conditions', () => {

+ 2 - 9
test/ownership/Whitelist.test.js

@@ -6,18 +6,11 @@ const WhitelistMock = artifacts.require('WhitelistMock');
 require('chai')
   .should();
 
-contract('Whitelist', function (accounts) {
-  const [
-    owner,
-    whitelistedAddress1,
-    whitelistedAddress2,
-    anyone,
-  ] = accounts;
-
+contract('Whitelist', function ([_, owner, whitelistedAddress1, whitelistedAddress2, anyone]) {
   const whitelistedAddresses = [whitelistedAddress1, whitelistedAddress2];
 
   beforeEach(async function () {
-    this.mock = await WhitelistMock.new();
+    this.mock = await WhitelistMock.new({ from: owner });
     this.role = await this.mock.ROLE_WHITELISTED();
   });
 

+ 9 - 18
test/ownership/rbac/RBAC.test.js

@@ -8,18 +8,11 @@ require('chai')
 
 const ROLE_ADVISOR = 'advisor';
 
-contract('RBAC', function (accounts) {
+contract('RBAC', function ([_, admin, anyone, advisor, otherAdvisor, futureAdvisor]) {
   let mock;
 
-  const [
-    admin,
-    anyone,
-    futureAdvisor,
-    ...advisors
-  ] = accounts;
-
   beforeEach(async () => {
-    mock = await RBACMock.new(advisors, { from: admin });
+    mock = await RBACMock.new([advisor, otherAdvisor], { from: admin });
   });
 
   context('in normal conditions', () => {
@@ -30,30 +23,28 @@ contract('RBAC', function (accounts) {
       await mock.onlyAdvisorsCanDoThis({ from: admin });
     });
     it('allows advisors to call #onlyAdvisorsCanDoThis', async () => {
-      await mock.onlyAdvisorsCanDoThis({ from: advisors[0] });
+      await mock.onlyAdvisorsCanDoThis({ from: advisor });
     });
     it('allows admin to call #eitherAdminOrAdvisorCanDoThis', async () => {
       await mock.eitherAdminOrAdvisorCanDoThis({ from: admin });
     });
     it('allows advisors to call #eitherAdminOrAdvisorCanDoThis', async () => {
-      await mock.eitherAdminOrAdvisorCanDoThis({ from: advisors[0] });
+      await mock.eitherAdminOrAdvisorCanDoThis({ from: advisor });
     });
     it('does not allow admins to call #nobodyCanDoThis', async () => {
       await expectThrow(mock.nobodyCanDoThis({ from: admin }));
     });
     it('does not allow advisors to call #nobodyCanDoThis', async () => {
-      await expectThrow(mock.nobodyCanDoThis({ from: advisors[0] }));
+      await expectThrow(mock.nobodyCanDoThis({ from: advisor }));
     });
     it('does not allow anyone to call #nobodyCanDoThis', async () => {
       await expectThrow(mock.nobodyCanDoThis({ from: anyone }));
     });
     it('allows an admin to remove an advisor\'s role', async () => {
-      await mock.removeAdvisor(advisors[0], { from: admin })
-      ;
+      await mock.removeAdvisor(advisor, { from: admin });
     });
     it('allows admins to #adminRemoveRole', async () => {
-      await mock.adminRemoveRole(advisors[3], ROLE_ADVISOR, { from: admin })
-      ;
+      await mock.adminRemoveRole(advisor, ROLE_ADVISOR, { from: admin });
     });
 
     it('announces a RoleAdded event on addRole', async () => {
@@ -73,10 +64,10 @@ contract('RBAC', function (accounts) {
 
   context('in adversarial conditions', () => {
     it('does not allow an advisor to remove another advisor', async () => {
-      await expectThrow(mock.removeAdvisor(advisors[1], { from: advisors[0] }));
+      await expectThrow(mock.removeAdvisor(otherAdvisor, { from: advisor }));
     });
     it('does not allow "anyone" to remove an advisor', async () => {
-      await expectThrow(mock.removeAdvisor(advisors[0], { from: anyone }));
+      await expectThrow(mock.removeAdvisor(advisor, { from: anyone }));
     });
   });
 });

+ 3 - 6
test/payment/ConditionalEscrow.test.js

@@ -10,24 +10,21 @@ require('chai')
 
 const ConditionalEscrowMock = artifacts.require('ConditionalEscrowMock');
 
-contract('ConditionalEscrow', function (accounts) {
-  const owner = accounts[0];
-
+contract('ConditionalEscrow', function ([_, owner, payee, ...otherAccounts]) {
   beforeEach(async function () {
     this.escrow = await ConditionalEscrowMock.new({ from: owner });
   });
 
   context('when withdrawal is allowed', function () {
     beforeEach(async function () {
-      await Promise.all(accounts.map(payee => this.escrow.setAllowed(payee, true)));
+      await Promise.all(otherAccounts.map(payee => this.escrow.setAllowed(payee, true)));
     });
 
-    shouldBehaveLikeEscrow(owner, accounts.slice(1));
+    shouldBehaveLikeEscrow(owner, otherAccounts);
   });
 
   context('when withdrawal is disallowed', function () {
     const amount = web3.toWei(23.0, 'ether');
-    const payee = accounts[1];
 
     beforeEach(async function () {
       await this.escrow.setAllowed(payee, false);

+ 2 - 4
test/payment/Escrow.test.js

@@ -2,12 +2,10 @@ const { shouldBehaveLikeEscrow } = require('./Escrow.behaviour');
 
 const Escrow = artifacts.require('Escrow');
 
-contract('Escrow', function (accounts) {
-  const owner = accounts[0];
-
+contract('Escrow', function ([_, owner, ...otherAccounts]) {
   beforeEach(async function () {
     this.escrow = await Escrow.new({ from: owner });
   });
 
-  shouldBehaveLikeEscrow(owner, accounts.slice(1));
+  shouldBehaveLikeEscrow(owner, otherAccounts);
 });

+ 20 - 21
test/payment/PullPayment.test.js

@@ -8,7 +8,7 @@ require('chai')
 
 const PullPaymentMock = artifacts.require('PullPaymentMock');
 
-contract('PullPayment', function (accounts) {
+contract('PullPayment', function ([_, payer, payee1, payee2]) {
   const amount = web3.toWei(17.0, 'ether');
 
   beforeEach(async function () {
@@ -21,44 +21,43 @@ contract('PullPayment', function (accounts) {
 
   it('can record an async payment correctly', async function () {
     const AMOUNT = 100;
-    await this.contract.callTransfer(accounts[0], AMOUNT);
+    await this.contract.callTransfer(payee1, AMOUNT, { from: payer });
 
-    const paymentsToAccount0 = await this.contract.payments(accounts[0]);
-    paymentsToAccount0.should.be.bignumber.equal(AMOUNT);
+    const paymentsToPayee1 = await this.contract.payments(payee1);
+    paymentsToPayee1.should.be.bignumber.equal(AMOUNT);
   });
 
   it('can add multiple balances on one account', async function () {
-    await this.contract.callTransfer(accounts[0], 200);
-    await this.contract.callTransfer(accounts[0], 300);
-    const paymentsToAccount0 = await this.contract.payments(accounts[0]);
-    paymentsToAccount0.should.be.bignumber.equal(500);
+    await this.contract.callTransfer(payee1, 200, { from: payer });
+    await this.contract.callTransfer(payee1, 300, { from: payer });
+    const paymentsToPayee1 = await this.contract.payments(payee1);
+    paymentsToPayee1.should.be.bignumber.equal(500);
   });
 
   it('can add balances on multiple accounts', async function () {
-    await this.contract.callTransfer(accounts[0], 200);
-    await this.contract.callTransfer(accounts[1], 300);
+    await this.contract.callTransfer(payee1, 200, { from: payer });
+    await this.contract.callTransfer(payee2, 300, { from: payer });
 
-    const paymentsToAccount0 = await this.contract.payments(accounts[0]);
-    paymentsToAccount0.should.be.bignumber.equal(200);
+    const paymentsToPayee1 = await this.contract.payments(payee1);
+    paymentsToPayee1.should.be.bignumber.equal(200);
 
-    const paymentsToAccount1 = await this.contract.payments(accounts[1]);
-    paymentsToAccount1.should.be.bignumber.equal(300);
+    const paymentsToPayee2 = await this.contract.payments(payee2);
+    paymentsToPayee2.should.be.bignumber.equal(300);
   });
 
   it('can withdraw payment', async function () {
-    const payee = accounts[1];
-    const initialBalance = await ethGetBalance(payee);
+    const initialBalance = await ethGetBalance(payee1);
 
-    await this.contract.callTransfer(payee, amount);
+    await this.contract.callTransfer(payee1, amount, { from: payer });
 
-    const payment1 = await this.contract.payments(payee);
+    const payment1 = await this.contract.payments(payee1);
     payment1.should.be.bignumber.equal(amount);
 
-    await this.contract.withdrawPayments({ from: payee });
-    const payment2 = await this.contract.payments(payee);
+    await this.contract.withdrawPayments({ from: payee1 });
+    const payment2 = await this.contract.payments(payee1);
     payment2.should.be.bignumber.equal(0);
 
-    const balance = await ethGetBalance(payee);
+    const balance = await ethGetBalance(payee1);
     Math.abs(balance - initialBalance - amount).should.be.lt(1e16);
   });
 });

+ 2 - 2
test/payment/RefundEscrow.test.js

@@ -11,7 +11,7 @@ require('chai')
 
 const RefundEscrow = artifacts.require('RefundEscrow');
 
-contract('RefundEscrow', function ([owner, beneficiary, refundee1, refundee2]) {
+contract('RefundEscrow', function ([_, owner, beneficiary, refundee1, refundee2]) {
   const amount = web3.toWei(54.0, 'ether');
   const refundees = [refundee1, refundee2];
 
@@ -92,7 +92,7 @@ contract('RefundEscrow', function ([owner, beneficiary, refundee1, refundee2]) {
     it('refunds refundees', async function () {
       for (const refundee of [refundee1, refundee2]) {
         const refundeeInitialBalance = await ethGetBalance(refundee);
-        await this.escrow.withdraw(refundee);
+        await this.escrow.withdraw(refundee, { from: owner });
         const refundeeFinalBalance = await ethGetBalance(refundee);
 
         refundeeFinalBalance.sub(refundeeInitialBalance).should.be.bignumber.equal(amount);

+ 1 - 1
test/payment/SplitPayment.test.js

@@ -10,7 +10,7 @@ const { expectThrow } = require('../helpers/expectThrow');
 const EVMThrow = require('../helpers/EVMThrow.js');
 const SplitPayment = artifacts.require('SplitPayment');
 
-contract('SplitPayment', function ([owner, payee1, payee2, payee3, nonpayee1, payer1]) {
+contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1, payer1]) {
   const amount = web3.toWei(1.0, 'ether');
 
   beforeEach(async function () {

+ 4 - 6
test/token/ERC20/BurnableToken.behaviour.js

@@ -8,19 +8,17 @@ require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-function shouldBehaveLikeBurnableToken ([owner], initialBalance) {
+function shouldBehaveLikeBurnableToken (owner, initialBalance) {
   describe('as a basic burnable token', function () {
-    const from = owner;
-
     describe('when the given amount is not greater than balance of the sender', function () {
       const amount = 100;
 
       beforeEach(async function () {
-        ({ logs: this.logs } = await this.token.burn(amount, { from }));
+        ({ logs: this.logs } = await this.token.burn(amount, { from: owner }));
       });
 
       it('burns the requested amount', async function () {
-        const balance = await this.token.balanceOf(from);
+        const balance = await this.token.balanceOf(owner);
         balance.should.be.bignumber.equal(initialBalance - amount);
       });
 
@@ -42,7 +40,7 @@ function shouldBehaveLikeBurnableToken ([owner], initialBalance) {
       const amount = initialBalance + 1;
 
       it('reverts', async function () {
-        await assertRevert(this.token.burn(amount, { from }));
+        await assertRevert(this.token.burn(amount, { from: owner }));
       });
     });
   });

+ 3 - 3
test/token/ERC20/BurnableToken.test.js

@@ -1,12 +1,12 @@
 const { shouldBehaveLikeBurnableToken } = require('./BurnableToken.behaviour');
 const BurnableTokenMock = artifacts.require('BurnableTokenMock');
 
-contract('BurnableToken', function ([owner]) {
+contract('BurnableToken', function ([_, owner]) {
   const initialBalance = 1000;
 
   beforeEach(async function () {
-    this.token = await BurnableTokenMock.new(owner, initialBalance);
+    this.token = await BurnableTokenMock.new(owner, initialBalance, { from: owner });
   });
 
-  shouldBehaveLikeBurnableToken([owner], initialBalance);
+  shouldBehaveLikeBurnableToken(owner, initialBalance);
 });

+ 6 - 6
test/token/ERC20/CappedToken.behaviour.js

@@ -1,6 +1,6 @@
 const { expectThrow } = require('../../helpers/expectThrow');
 
-function shouldBehaveLikeCappedToken ([owner, anotherAccount, minter, cap]) {
+function shouldBehaveLikeCappedToken (minter, [anyone], cap) {
   describe('capped token', function () {
     const from = minter;
 
@@ -11,18 +11,18 @@ function shouldBehaveLikeCappedToken ([owner, anotherAccount, minter, cap]) {
     });
 
     it('should mint when amount is less than cap', async function () {
-      const result = await this.token.mint(owner, cap.sub(1), { from });
+      const result = await this.token.mint(anyone, cap.sub(1), { from });
       assert.equal(result.logs[0].event, 'Mint');
     });
 
     it('should fail to mint if the ammount exceeds the cap', async function () {
-      await this.token.mint(owner, cap.sub(1), { from });
-      await expectThrow(this.token.mint(owner, 100, { from }));
+      await this.token.mint(anyone, cap.sub(1), { from });
+      await expectThrow(this.token.mint(anyone, 100, { from }));
     });
 
     it('should fail to mint after cap is reached', async function () {
-      await this.token.mint(owner, cap, { from });
-      await expectThrow(this.token.mint(owner, 1, { from }));
+      await this.token.mint(anyone, cap, { from });
+      await expectThrow(this.token.mint(anyone, 1, { from }));
     });
   });
 }

+ 5 - 6
test/token/ERC20/CappedToken.test.js

@@ -4,14 +4,13 @@ const { shouldBehaveLikeCappedToken } = require('./CappedToken.behaviour');
 
 const CappedToken = artifacts.require('CappedToken');
 
-contract('Capped', function ([owner, anotherAccount]) {
-  const _cap = ether(1000);
+contract('Capped', function ([_, owner, ...otherAccounts]) {
+  const cap = ether(1000);
 
   beforeEach(async function () {
-    this.token = await CappedToken.new(_cap, { from: owner });
+    this.token = await CappedToken.new(cap, { from: owner });
   });
 
-  shouldBehaveLikeCappedToken([owner, anotherAccount, owner, _cap]);
-
-  shouldBehaveLikeMintableToken([owner, anotherAccount, owner]);
+  shouldBehaveLikeCappedToken(owner, otherAccounts, cap);
+  shouldBehaveLikeMintableToken(owner, owner, otherAccounts);
 });

+ 1 - 1
test/token/ERC20/DetailedERC20.test.js

@@ -6,7 +6,7 @@ require('chai')
 
 const DetailedERC20Mock = artifacts.require('DetailedERC20Mock');
 
-contract('DetailedERC20', accounts => {
+contract('DetailedERC20', function () {
   let detailedERC20 = null;
 
   const _name = 'My Detailed ERC20';

+ 3 - 3
test/token/ERC20/MintableToken.behaviour.js

@@ -6,7 +6,7 @@ require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-function shouldBehaveLikeMintableToken ([owner, anotherAccount, minter]) {
+function shouldBehaveLikeMintableToken (owner, minter, [anyone]) {
   describe('as a basic mintable token', function () {
     describe('after token creation', function () {
       it('sender should be token owner', async function () {
@@ -67,7 +67,7 @@ function shouldBehaveLikeMintableToken ([owner, anotherAccount, minter]) {
       });
 
       describe('when the sender is not the token owner', function () {
-        const from = anotherAccount;
+        const from = anyone;
 
         describe('when the token minting was not finished', function () {
           it('reverts', async function () {
@@ -124,7 +124,7 @@ function shouldBehaveLikeMintableToken ([owner, anotherAccount, minter]) {
       });
 
       describe('when the sender has not the minting permission', function () {
-        const from = anotherAccount;
+        const from = anyone;
 
         describe('when the token minting is not finished', function () {
           it('reverts', async function () {

+ 2 - 4
test/token/ERC20/MintableToken.test.js

@@ -1,12 +1,10 @@
 const { shouldBehaveLikeMintableToken } = require('./MintableToken.behaviour');
 const MintableToken = artifacts.require('MintableToken');
 
-contract('MintableToken', function ([owner, anotherAccount]) {
-  const minter = owner;
-
+contract('MintableToken', function ([_, owner, ...otherAccounts]) {
   beforeEach(async function () {
     this.token = await MintableToken.new({ from: owner });
   });
 
-  shouldBehaveLikeMintableToken([owner, anotherAccount, minter]);
+  shouldBehaveLikeMintableToken(owner, owner, otherAccounts);
 });

+ 6 - 6
test/token/ERC20/RBACCappedToken.test.js

@@ -5,15 +5,15 @@ const { shouldBehaveLikeCappedToken } = require('./CappedToken.behaviour');
 
 const RBACCappedTokenMock = artifacts.require('RBACCappedTokenMock');
 
-contract('RBACCappedToken', function ([owner, anotherAccount, minter]) {
-  const _cap = ether(1000);
+contract('RBACCappedToken', function ([_, owner, minter, ...otherAccounts]) {
+  const cap = ether(1000);
 
   beforeEach(async function () {
-    this.token = await RBACCappedTokenMock.new(_cap, { from: owner });
+    this.token = await RBACCappedTokenMock.new(cap, { from: owner });
     await this.token.addMinter(minter, { from: owner });
   });
 
-  shouldBehaveLikeMintableToken([owner, anotherAccount, minter]);
-  shouldBehaveLikeRBACMintableToken([owner, anotherAccount]);
-  shouldBehaveLikeCappedToken([owner, anotherAccount, minter, _cap]);
+  shouldBehaveLikeMintableToken(owner, minter, otherAccounts);
+  shouldBehaveLikeRBACMintableToken(owner, otherAccounts);
+  shouldBehaveLikeCappedToken(minter, otherAccounts, cap);
 });

+ 9 - 9
test/token/ERC20/RBACMintableToken.behaviour.js

@@ -2,26 +2,26 @@ const { expectThrow } = require('../../helpers/expectThrow');
 
 const ROLE_MINTER = 'minter';
 
-function shouldBehaveLikeRBACMintableToken ([owner, anotherAccount]) {
+function shouldBehaveLikeRBACMintableToken (owner, [anyone]) {
   describe('handle roles', function () {
     it('owner can add and remove a minter role', async function () {
-      await this.token.addMinter(anotherAccount, { from: owner });
-      let hasRole = await this.token.hasRole(anotherAccount, ROLE_MINTER);
+      await this.token.addMinter(anyone, { from: owner });
+      let hasRole = await this.token.hasRole(anyone, ROLE_MINTER);
       assert.equal(hasRole, true);
 
-      await this.token.removeMinter(anotherAccount, { from: owner });
-      hasRole = await this.token.hasRole(anotherAccount, ROLE_MINTER);
+      await this.token.removeMinter(anyone, { from: owner });
+      hasRole = await this.token.hasRole(anyone, ROLE_MINTER);
       assert.equal(hasRole, false);
     });
 
-    it('another account can\'t add or remove a minter role', async function () {
+    it('anyone can\'t add or remove a minter role', async function () {
       await expectThrow(
-        this.token.addMinter(anotherAccount, { from: anotherAccount })
+        this.token.addMinter(anyone, { from: anyone })
       );
 
-      await this.token.addMinter(anotherAccount, { from: owner });
+      await this.token.addMinter(anyone, { from: owner });
       await expectThrow(
-        this.token.removeMinter(anotherAccount, { from: anotherAccount })
+        this.token.removeMinter(anyone, { from: anyone })
       );
     });
   });

+ 3 - 3
test/token/ERC20/RBACMintableToken.test.js

@@ -3,12 +3,12 @@ const { shouldBehaveLikeMintableToken } = require('./MintableToken.behaviour');
 
 const RBACMintableToken = artifacts.require('RBACMintableToken');
 
-contract('RBACMintableToken', function ([owner, anotherAccount, minter]) {
+contract('RBACMintableToken', function ([_, owner, minter, ...otherAccounts]) {
   beforeEach(async function () {
     this.token = await RBACMintableToken.new({ from: owner });
     await this.token.addMinter(minter, { from: owner });
   });
 
-  shouldBehaveLikeRBACMintableToken([owner, anotherAccount, minter]);
-  shouldBehaveLikeMintableToken([owner, anotherAccount, minter]);
+  shouldBehaveLikeRBACMintableToken(owner, otherAccounts);
+  shouldBehaveLikeMintableToken(owner, minter, otherAccounts);
 });

+ 2 - 2
test/token/ERC20/StandardBurnableToken.test.js

@@ -10,14 +10,14 @@ require('chai')
   .use(require('chai-bignumber')(BigNumber))
   .should();
 
-contract('StandardBurnableToken', function ([owner, burner]) {
+contract('StandardBurnableToken', function ([_, owner, burner]) {
   const initialBalance = 1000;
 
   beforeEach(async function () {
     this.token = await StandardBurnableTokenMock.new(owner, initialBalance);
   });
 
-  shouldBehaveLikeBurnableToken([owner], initialBalance);
+  shouldBehaveLikeBurnableToken(owner, initialBalance);
 
   describe('burnFrom', function () {
     describe('on success', function () {