Browse Source

No longer assigning awaits to temporary variables. (#1216)

Nicolás Venturo 7 years ago
parent
commit
20cf885430
43 changed files with 231 additions and 467 deletions
  1. 2 4
      test/crowdsale/AllowanceCrowdsale.test.js
  2. 3 6
      test/crowdsale/CappedCrowdsale.test.js
  3. 2 4
      test/crowdsale/Crowdsale.test.js
  4. 7 15
      test/crowdsale/IncreasingPriceCrowdsale.test.js
  5. 4 8
      test/crowdsale/IndividuallyCappedCrowdsale.test.js
  6. 1 2
      test/crowdsale/MintedCrowdsale.behavior.js
  7. 2 4
      test/crowdsale/MintedCrowdsale.test.js
  8. 2 4
      test/crowdsale/PostDeliveryCrowdsale.test.js
  9. 2 4
      test/crowdsale/TimedCrowdsale.test.js
  10. 5 10
      test/crowdsale/WhitelistedCrowdsale.test.js
  11. 6 13
      test/examples/SampleCrowdsale.test.js
  12. 3 6
      test/examples/SimpleToken.test.js
  13. 2 4
      test/introspection/SupportsInterface.behavior.js
  14. 6 11
      test/library/ECRecovery.test.js
  15. 4 8
      test/library/Math.test.js
  16. 3 6
      test/library/MerkleProof.test.js
  17. 8 19
      test/lifecycle/Pausable.test.js
  18. 4 8
      test/lifecycle/TokenDestructible.test.js
  19. 5 10
      test/math/SafeMath.test.js
  20. 3 4
      test/ownership/CanReclaimToken.test.js
  21. 2 5
      test/ownership/Claimable.test.js
  22. 2 4
      test/ownership/Contactable.test.js
  23. 6 12
      test/ownership/DelayedClaimable.test.js
  24. 4 7
      test/ownership/HasNoEther.test.js
  25. 3 5
      test/ownership/HasNoTokens.test.js
  26. 5 10
      test/ownership/Superuser.test.js
  27. 4 8
      test/ownership/Whitelist.test.js
  28. 12 19
      test/payment/Escrow.behavior.js
  29. 6 12
      test/payment/PullPayment.test.js
  30. 1 2
      test/payment/RefundEscrow.test.js
  31. 5 10
      test/payment/SplitPayment.test.js
  32. 1 2
      test/proposals/ERC1046/TokenMetadata.test.js
  33. 3 6
      test/token/ERC20/BurnableToken.behavior.js
  34. 3 6
      test/token/ERC20/DetailedERC20.test.js
  35. 5 10
      test/token/ERC20/MintableToken.behavior.js
  36. 19 47
      test/token/ERC20/PausableToken.test.js
  37. 2 4
      test/token/ERC20/RBACMintableToken.behavior.js
  38. 25 53
      test/token/ERC20/StandardToken.test.js
  39. 3 6
      test/token/ERC20/TokenTimelock.test.js
  40. 6 9
      test/token/ERC20/TokenVesting.test.js
  41. 18 36
      test/token/ERC721/ERC721BasicToken.behavior.js
  42. 4 8
      test/token/ERC721/ERC721MintBurn.behavior.js
  43. 18 36
      test/token/ERC721/ERC721Token.test.js

+ 2 - 4
test/crowdsale/AllowanceCrowdsale.test.js

@@ -47,8 +47,7 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
 
     it('should assign tokens to sender', async function () {
       await this.crowdsale.sendTransaction({ value: value, from: investor });
-      const balance = await this.token.balanceOf(investor);
-      balance.should.be.bignumber.equal(expectedTokenAmount);
+      (await this.token.balanceOf(investor)).should.be.bignumber.equal(expectedTokenAmount);
     });
 
     it('should forward funds to wallet', async function () {
@@ -63,8 +62,7 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
     it('should report correct allowace left', async function () {
       const remainingAllowance = tokenAllowance - expectedTokenAmount;
       await this.crowdsale.buyTokens(investor, { value: value, from: purchaser });
-      const tokensRemaining = await this.crowdsale.remainingTokens();
-      tokensRemaining.should.be.bignumber.equal(remainingAllowance);
+      (await this.crowdsale.remainingTokens()).should.be.bignumber.equal(remainingAllowance);
     });
   });
 

+ 3 - 6
test/crowdsale/CappedCrowdsale.test.js

@@ -57,20 +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);
-      const capReached = await this.crowdsale.capReached();
-      capReached.should.eq(false);
+      (await this.crowdsale.capReached()).should.be.false;
     });
 
     it('should not reach cap if sent just under cap', async function () {
       await this.crowdsale.send(cap.minus(1));
-      const capReached = await this.crowdsale.capReached();
-      capReached.should.eq(false);
+      (await this.crowdsale.capReached()).should.be.false;
     });
 
     it('should reach cap if cap sent', async function () {
       await this.crowdsale.send(cap);
-      const capReached = await this.crowdsale.capReached();
-      capReached.should.eq(true);
+      (await this.crowdsale.capReached()).should.be.true;
     });
   });
 });

+ 2 - 4
test/crowdsale/Crowdsale.test.js

@@ -92,8 +92,7 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) {
 
         it('should assign tokens to sender', async function () {
           await this.crowdsale.sendTransaction({ value: value, from: investor });
-          const balance = await this.token.balanceOf(investor);
-          balance.should.be.bignumber.equal(expectedTokenAmount);
+          (await this.token.balanceOf(investor)).should.be.bignumber.equal(expectedTokenAmount);
         });
 
         it('should forward funds to wallet', async function () {
@@ -117,8 +116,7 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) {
 
         it('should assign tokens to beneficiary', async function () {
           await this.crowdsale.buyTokens(investor, { value, from: purchaser });
-          const balance = await this.token.balanceOf(investor);
-          balance.should.be.bignumber.equal(expectedTokenAmount);
+          (await this.token.balanceOf(investor)).should.be.bignumber.equal(expectedTokenAmount);
         });
 
         it('should forward funds to wallet', async function () {

+ 7 - 15
test/crowdsale/IncreasingPriceCrowdsale.test.js

@@ -17,7 +17,6 @@ contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser])
   const tokenSupply = new BigNumber('1e22');
 
   describe('rate during crowdsale should change at a fixed step every block', async function () {
-    let balance;
     const initialRate = new BigNumber(9166);
     const finalRate = new BigNumber(5500);
     const rateAtTime150 = new BigNumber(9166);
@@ -42,50 +41,43 @@ contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser])
     it('at start', async function () {
       await increaseTimeTo(this.startTime);
       await this.crowdsale.buyTokens(investor, { value, from: purchaser });
-      balance = await this.token.balanceOf(investor);
-      balance.should.be.bignumber.equal(value.mul(initialRate));
+      (await this.token.balanceOf(investor)).should.be.bignumber.equal(value.mul(initialRate));
     });
 
     it('at time 150', async function () {
       await increaseTimeTo(this.startTime + 150);
       await this.crowdsale.buyTokens(investor, { value, from: purchaser });
-      balance = await this.token.balanceOf(investor);
-      balance.should.be.bignumber.equal(value.mul(rateAtTime150));
+      (await this.token.balanceOf(investor)).should.be.bignumber.equal(value.mul(rateAtTime150));
     });
 
     it('at time 300', async function () {
       await increaseTimeTo(this.startTime + 300);
       await this.crowdsale.buyTokens(investor, { value, from: purchaser });
-      balance = await this.token.balanceOf(investor);
-      balance.should.be.bignumber.equal(value.mul(rateAtTime300));
+      (await this.token.balanceOf(investor)).should.be.bignumber.equal(value.mul(rateAtTime300));
     });
 
     it('at time 1500', async function () {
       await increaseTimeTo(this.startTime + 1500);
       await this.crowdsale.buyTokens(investor, { value, from: purchaser });
-      balance = await this.token.balanceOf(investor);
-      balance.should.be.bignumber.equal(value.mul(rateAtTime1500));
+      (await this.token.balanceOf(investor)).should.be.bignumber.equal(value.mul(rateAtTime1500));
     });
 
     it('at time 30', async function () {
       await increaseTimeTo(this.startTime + 30);
       await this.crowdsale.buyTokens(investor, { value, from: purchaser });
-      balance = await this.token.balanceOf(investor);
-      balance.should.be.bignumber.equal(value.mul(rateAtTime30));
+      (await this.token.balanceOf(investor)).should.be.bignumber.equal(value.mul(rateAtTime30));
     });
 
     it('at time 150000', async function () {
       await increaseTimeTo(this.startTime + 150000);
       await this.crowdsale.buyTokens(investor, { value, from: purchaser });
-      balance = await this.token.balanceOf(investor);
-      balance.should.be.bignumber.equal(value.mul(rateAtTime150000));
+      (await this.token.balanceOf(investor)).should.be.bignumber.equal(value.mul(rateAtTime150000));
     });
 
     it('at time 450000', async function () {
       await increaseTimeTo(this.startTime + 450000);
       await this.crowdsale.buyTokens(investor, { value, from: purchaser });
-      balance = await this.token.balanceOf(investor);
-      balance.should.be.bignumber.equal(value.mul(rateAtTime450000));
+      (await this.token.balanceOf(investor)).should.be.bignumber.equal(value.mul(rateAtTime450000));
     });
   });
 });

+ 4 - 8
test/crowdsale/IndividuallyCappedCrowdsale.test.js

@@ -56,14 +56,12 @@ contract('IndividuallyCappedCrowdsale', function ([_, wallet, alice, bob, charli
 
     describe('reporting state', function () {
       it('should report correct cap', async function () {
-        const retrievedCap = await this.crowdsale.getUserCap(alice);
-        retrievedCap.should.be.bignumber.equal(capAlice);
+        (await this.crowdsale.getUserCap(alice)).should.be.bignumber.equal(capAlice);
       });
 
       it('should report actual contribution', async function () {
         await this.crowdsale.buyTokens(alice, { value: lessThanCapAlice });
-        const retrievedContribution = await this.crowdsale.getUserContribution(alice);
-        retrievedContribution.should.be.bignumber.equal(lessThanCapAlice);
+        (await this.crowdsale.getUserContribution(alice)).should.be.bignumber.equal(lessThanCapAlice);
       });
     });
   });
@@ -97,10 +95,8 @@ contract('IndividuallyCappedCrowdsale', function ([_, wallet, alice, bob, charli
 
     describe('reporting state', function () {
       it('should report correct cap', async function () {
-        const retrievedCapBob = await this.crowdsale.getUserCap(bob);
-        retrievedCapBob.should.be.bignumber.equal(capBob);
-        const retrievedCapCharlie = await this.crowdsale.getUserCap(charlie);
-        retrievedCapCharlie.should.be.bignumber.equal(capBob);
+        (await this.crowdsale.getUserCap(bob)).should.be.bignumber.equal(capBob);
+        (await this.crowdsale.getUserCap(charlie)).should.be.bignumber.equal(capBob);
       });
     });
   });

+ 1 - 2
test/crowdsale/MintedCrowdsale.behavior.js

@@ -30,8 +30,7 @@ function shouldBehaveLikeMintedCrowdsale ([_, investor, wallet, purchaser], rate
 
       it('should assign tokens to sender', async function () {
         await this.crowdsale.sendTransaction({ value: value, from: investor });
-        const balance = await this.token.balanceOf(investor);
-        balance.should.be.bignumber.equal(expectedTokenAmount);
+        (await this.token.balanceOf(investor)).should.be.bignumber.equal(expectedTokenAmount);
       });
 
       it('should forward funds to wallet', async function () {

+ 2 - 4
test/crowdsale/MintedCrowdsale.test.js

@@ -19,8 +19,7 @@ contract('MintedCrowdsale', function ([_, investor, wallet, purchaser]) {
     });
 
     it('should be token owner', async function () {
-      const owner = await this.token.owner();
-      owner.should.eq(this.crowdsale.address);
+      (await this.token.owner()).should.eq(this.crowdsale.address);
     });
 
     shouldBehaveLikeMintedCrowdsale([_, investor, wallet, purchaser], rate, value);
@@ -36,8 +35,7 @@ contract('MintedCrowdsale', function ([_, investor, wallet, purchaser]) {
     });
 
     it('should have minter role on token', async function () {
-      const isMinter = await this.token.hasRole(this.crowdsale.address, ROLE_MINTER);
-      isMinter.should.eq(true);
+      (await this.token.hasRole(this.crowdsale.address, ROLE_MINTER)).should.be.true;
     });
 
     shouldBehaveLikeMintedCrowdsale([_, investor, wallet, purchaser], rate, value);

+ 2 - 4
test/crowdsale/PostDeliveryCrowdsale.test.js

@@ -39,8 +39,7 @@ contract('PostDeliveryCrowdsale', function ([_, investor, wallet, purchaser]) {
   it('should not immediately assign tokens to beneficiary', async function () {
     await increaseTimeTo(this.openingTime);
     await this.crowdsale.buyTokens(investor, { value: value, from: purchaser });
-    const balance = await this.token.balanceOf(investor);
-    balance.should.be.bignumber.equal(0);
+    (await this.token.balanceOf(investor)).should.be.bignumber.equal(0);
   });
 
   it('should not allow beneficiaries to withdraw tokens before crowdsale ends', async function () {
@@ -61,7 +60,6 @@ contract('PostDeliveryCrowdsale', function ([_, investor, wallet, purchaser]) {
     await this.crowdsale.buyTokens(investor, { value: value, from: purchaser });
     await increaseTimeTo(this.afterClosingTime);
     await this.crowdsale.withdrawTokens({ from: investor });
-    const balance = await this.token.balanceOf(investor);
-    balance.should.be.bignumber.equal(value);
+    (await this.token.balanceOf(investor)).should.be.bignumber.equal(value);
   });
 });

+ 2 - 4
test/crowdsale/TimedCrowdsale.test.js

@@ -34,11 +34,9 @@ contract('TimedCrowdsale', function ([_, investor, wallet, purchaser]) {
   });
 
   it('should be ended only after end', async function () {
-    let ended = await this.crowdsale.hasClosed();
-    ended.should.eq(false);
+    (await this.crowdsale.hasClosed()).should.be.false;
     await increaseTimeTo(this.afterClosingTime);
-    ended = await this.crowdsale.hasClosed();
-    ended.should.eq(true);
+    (await this.crowdsale.hasClosed()).should.be.true;
   });
 
   describe('accepting payments', function () {

+ 5 - 10
test/crowdsale/WhitelistedCrowdsale.test.js

@@ -43,10 +43,8 @@ contract('WhitelistedCrowdsale', function ([_, wallet, authorized, unauthorized,
 
     describe('reporting whitelisted', function () {
       it('should correctly report whitelisted addresses', async function () {
-        const isAuthorized = await this.crowdsale.whitelist(authorized);
-        isAuthorized.should.eq(true);
-        const isntAuthorized = await this.crowdsale.whitelist(unauthorized);
-        isntAuthorized.should.eq(false);
+        (await this.crowdsale.whitelist(authorized)).should.be.true;
+        (await this.crowdsale.whitelist(unauthorized)).should.be.false;
       });
     });
   });
@@ -82,12 +80,9 @@ contract('WhitelistedCrowdsale', function ([_, wallet, authorized, unauthorized,
 
     describe('reporting whitelisted', function () {
       it('should correctly report whitelisted addresses', async function () {
-        const isAuthorized = await this.crowdsale.whitelist(authorized);
-        isAuthorized.should.eq(true);
-        const isAnotherAuthorized = await this.crowdsale.whitelist(anotherAuthorized);
-        isAnotherAuthorized.should.eq(true);
-        const isntAuthorized = await this.crowdsale.whitelist(unauthorized);
-        isntAuthorized.should.eq(false);
+        (await this.crowdsale.whitelist(authorized)).should.be.true;
+        (await this.crowdsale.whitelist(anotherAuthorized)).should.be.true;
+        (await this.crowdsale.whitelist(unauthorized)).should.be.false;
       });
     });
   });

+ 6 - 13
test/examples/SampleCrowdsale.test.js

@@ -43,19 +43,12 @@ contract('SampleCrowdsale', function ([_, owner, wallet, investor]) {
     this.crowdsale.should.exist;
     this.token.should.exist;
 
-    const openingTime = await this.crowdsale.openingTime();
-    const closingTime = await this.crowdsale.closingTime();
-    const rate = await this.crowdsale.rate();
-    const walletAddress = await this.crowdsale.wallet();
-    const goal = await this.crowdsale.goal();
-    const cap = await this.crowdsale.cap();
-
-    openingTime.should.be.bignumber.equal(this.openingTime);
-    closingTime.should.be.bignumber.equal(this.closingTime);
-    rate.should.be.bignumber.equal(RATE);
-    walletAddress.should.be.equal(wallet);
-    goal.should.be.bignumber.equal(GOAL);
-    cap.should.be.bignumber.equal(CAP);
+    (await this.crowdsale.openingTime()).should.be.bignumber.equal(this.openingTime);
+    (await this.crowdsale.closingTime()).should.be.bignumber.equal(this.closingTime);
+    (await this.crowdsale.rate()).should.be.bignumber.equal(RATE);
+    (await this.crowdsale.wallet()).should.be.equal(wallet);
+    (await this.crowdsale.goal()).should.be.bignumber.equal(GOAL);
+    (await this.crowdsale.cap()).should.be.bignumber.equal(CAP);
   });
 
   it('should not accept payments before start', async function () {

+ 3 - 6
test/examples/SimpleToken.test.js

@@ -17,18 +17,15 @@ contract('SimpleToken', function ([_, creator]) {
   });
 
   it('has a name', async function () {
-    const name = await token.name();
-    name.should.eq('SimpleToken');
+    (await token.name()).should.eq('SimpleToken');
   });
 
   it('has a symbol', async function () {
-    const symbol = await token.symbol();
-    symbol.should.eq('SIM');
+    (await token.symbol()).should.eq('SIM');
   });
 
   it('has 18 decimals', async function () {
-    const decimals = await token.decimals();
-    decimals.should.be.bignumber.equal(18);
+    (await token.decimals()).should.be.bignumber.equal(18);
   });
 
   it('assigns the initial total supply to the creator', async function () {

+ 2 - 4
test/introspection/SupportsInterface.behavior.js

@@ -40,13 +40,11 @@ function shouldSupportInterfaces (interfaces = []) {
       const interfaceId = INTERFACE_IDS[k];
       describe(k, function () {
         it('should use less than 30k gas', async function () {
-          const gasEstimate = await this.thing.supportsInterface.estimateGas(interfaceId);
-          gasEstimate.should.be.lte(30000);
+          (await this.thing.supportsInterface.estimateGas(interfaceId)).should.be.lte(30000);
         });
 
         it('is supported', async function () {
-          const isSupported = await this.thing.supportsInterface(interfaceId);
-          isSupported.should.eq(true);
+          (await this.thing.supportsInterface(interfaceId)).should.be.true;
         });
       });
     }

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

@@ -20,8 +20,7 @@ contract('ECRecovery', function ([_, anyone]) {
     const message = web3.sha3(TEST_MESSAGE);
     // eslint-disable-next-line max-len
     const signature = '0x5d99b6f7f6d1f73d1a26497f2b1c89b24c0993913f86e9a2d02cd69887d9c94f3c880358579d811b21dd1b7fd9bb01c1d81d10e69f0384e675c32b39643be89200';
-    const addrRecovered = await ecrecovery.recover(message, signature);
-    addrRecovered.should.eq(signer);
+    (await ecrecovery.recover(message, signature)).should.eq(signer);
   });
 
   it('recover v1', async function () {
@@ -30,8 +29,7 @@ contract('ECRecovery', function ([_, anyone]) {
     const message = web3.sha3(TEST_MESSAGE);
     // eslint-disable-next-line max-len
     const signature = '0x331fe75a821c982f9127538858900d87d3ec1f9f737338ad67cad133fa48feff48e6fa0c18abc62e42820f05943e47af3e9fbe306ce74d64094bdf1691ee53e001';
-    const addrRecovered = await ecrecovery.recover(message, signature);
-    addrRecovered.should.eq(signer);
+    (await ecrecovery.recover(message, signature)).should.eq(signer);
   });
 
   it('recover using web3.eth.sign()', async function () {
@@ -39,11 +37,10 @@ contract('ECRecovery', function ([_, anyone]) {
     const signature = signMessage(anyone, web3.sha3(TEST_MESSAGE));
 
     // Recover the signer address from the generated message and signature.
-    const addrRecovered = await ecrecovery.recover(
+    (await ecrecovery.recover(
       hashMessage(TEST_MESSAGE),
       signature
-    );
-    addrRecovered.should.eq(anyone);
+    )).should.eq(anyone);
   });
 
   it('recover using web3.eth.sign() should return wrong signer', async function () {
@@ -51,8 +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.
-    const addrRecovered = await ecrecovery.recover(hashMessage('Nope'), signature);
-    addrRecovered.should.not.eq(anyone);
+    (await ecrecovery.recover(hashMessage('Nope'), signature)).should.not.eq(anyone);
   });
 
   it('recover should revert when a small hash is sent', async function () {
@@ -70,8 +66,7 @@ contract('ECRecovery', function ([_, anyone]) {
   context('toEthSignedMessage', () => {
     it('should prefix hashes correctly', async function () {
       const hashedMessage = web3.sha3(TEST_MESSAGE);
-      const ethMessage = await ecrecovery.toEthSignedMessageHash(hashedMessage);
-      ethMessage.should.eq(hashMessage(TEST_MESSAGE));
+      (await ecrecovery.toEthSignedMessageHash(hashedMessage)).should.eq(hashMessage(TEST_MESSAGE));
     });
   });
 });

+ 4 - 8
test/library/Math.test.js

@@ -16,25 +16,21 @@ contract('Math', function () {
 
   describe('max', function () {
     it('is correctly detected in first argument position', async function () {
-      const result = await this.math.max(max, min);
-      result.should.be.bignumber.equal(max);
+      (await this.math.max(max, min)).should.be.bignumber.equal(max);
     });
 
     it('is correctly detected in second argument position', async function () {
-      const result = await this.math.max(min, max);
-      result.should.be.bignumber.equal(max);
+      (await this.math.max(min, max)).should.be.bignumber.equal(max);
     });
   });
 
   describe('min', function () {
     it('is correctly detected in first argument position', async function () {
-      const result = await this.math.min(min, max);
-      result.should.be.bignumber.equal(min);
+      (await this.math.min(min, max)).should.be.bignumber.equal(min);
     });
 
     it('is correctly detected in second argument position', async function () {
-      const result = await this.math.min(max, min);
-      result.should.be.bignumber.equal(min);
+      (await this.math.min(max, min)).should.be.bignumber.equal(min);
     });
   });
 

+ 3 - 6
test/library/MerkleProof.test.js

@@ -24,8 +24,7 @@ contract('MerkleProof', function () {
 
       const leaf = bufferToHex(sha3(elements[0]));
 
-      const result = await merkleProof.verifyProof(proof, root, leaf);
-      result.should.be.true;
+      (await merkleProof.verifyProof(proof, root, leaf)).should.be.true;
     });
 
     it('should return false for an invalid Merkle proof', async function () {
@@ -41,8 +40,7 @@ contract('MerkleProof', function () {
 
       const badProof = badMerkleTree.getHexProof(badElements[0]);
 
-      const result = await merkleProof.verifyProof(badProof, correctRoot, correctLeaf);
-      result.should.be.false;
+      (await merkleProof.verifyProof(badProof, correctRoot, correctLeaf)).should.be.false;
     });
 
     it('should return false for a Merkle proof of invalid length', async function () {
@@ -56,8 +54,7 @@ contract('MerkleProof', function () {
 
       const leaf = bufferToHex(sha3(elements[0]));
 
-      const result = await merkleProof.verifyProof(badProof, root, leaf);
-      result.should.be.false;
+      (await merkleProof.verifyProof(badProof, root, leaf)).should.be.false;
     });
   });
 });

+ 8 - 19
test/lifecycle/Pausable.test.js

@@ -13,46 +13,36 @@ contract('Pausable', function () {
   });
 
   it('can perform normal process in non-pause', async function () {
-    const count0 = await this.Pausable.count();
-    count0.should.be.bignumber.equal(0);
+    (await this.Pausable.count()).should.be.bignumber.equal(0);
 
     await this.Pausable.normalProcess();
-    const count1 = await this.Pausable.count();
-    count1.should.be.bignumber.equal(1);
+    (await this.Pausable.count()).should.be.bignumber.equal(1);
   });
 
   it('can not perform normal process in pause', async function () {
     await this.Pausable.pause();
-    const count0 = await this.Pausable.count();
-    count0.should.be.bignumber.equal(0);
+    (await this.Pausable.count()).should.be.bignumber.equal(0);
 
     await assertRevert(this.Pausable.normalProcess());
-    const count1 = await this.Pausable.count();
-    count1.should.be.bignumber.equal(0);
+    (await this.Pausable.count()).should.be.bignumber.equal(0);
   });
 
   it('can not take drastic measure in non-pause', async function () {
     await assertRevert(this.Pausable.drasticMeasure());
-    const drasticMeasureTaken = await this.Pausable.drasticMeasureTaken();
-
-    drasticMeasureTaken.should.be.false;
+    (await this.Pausable.drasticMeasureTaken()).should.be.false;
   });
 
   it('can take a drastic measure in a pause', async function () {
     await this.Pausable.pause();
     await this.Pausable.drasticMeasure();
-    const drasticMeasureTaken = await this.Pausable.drasticMeasureTaken();
-
-    drasticMeasureTaken.should.be.true;
+    (await this.Pausable.drasticMeasureTaken()).should.be.true;
   });
 
   it('should resume allowing normal process after pause is over', async function () {
     await this.Pausable.pause();
     await this.Pausable.unpause();
     await this.Pausable.normalProcess();
-    const count0 = await this.Pausable.count();
-
-    count0.should.be.bignumber.equal(1);
+    (await this.Pausable.count()).should.be.bignumber.equal(1);
   });
 
   it('should prevent drastic measure after pause is over', async function () {
@@ -61,7 +51,6 @@ contract('Pausable', function () {
 
     await assertRevert(this.Pausable.drasticMeasure());
 
-    const drasticMeasureTaken = await this.Pausable.drasticMeasureTaken();
-    drasticMeasureTaken.should.be.false;
+    (await this.Pausable.drasticMeasureTaken()).should.be.false;
   });
 });

+ 4 - 8
test/lifecycle/TokenDestructible.test.js

@@ -29,15 +29,11 @@ contract('TokenDestructible', function ([_, owner]) {
 
   it('should send tokens to owner after destruction', async function () {
     const token = await StandardTokenMock.new(tokenDestructible.address, 100);
-    const initContractBalance = await token.balanceOf(tokenDestructible.address);
-    const initOwnerBalance = await token.balanceOf(owner);
-    initContractBalance.should.be.bignumber.equal(100);
-    initOwnerBalance.should.be.bignumber.equal(0);
+    (await token.balanceOf(tokenDestructible.address)).should.be.bignumber.equal(100);
+    (await token.balanceOf(owner)).should.be.bignumber.equal(0);
 
     await tokenDestructible.destroy([token.address], { from: owner });
-    const newContractBalance = await token.balanceOf(tokenDestructible.address);
-    const newOwnerBalance = await token.balanceOf(owner);
-    newContractBalance.should.be.bignumber.equal(0);
-    newOwnerBalance.should.be.bignumber.equal(100);
+    (await token.balanceOf(tokenDestructible.address)).should.be.bignumber.equal(0);
+    (await token.balanceOf(owner)).should.be.bignumber.equal(100);
   });
 });

+ 5 - 10
test/math/SafeMath.test.js

@@ -19,8 +19,7 @@ contract('SafeMath', () => {
       const a = new BigNumber(5678);
       const b = new BigNumber(1234);
 
-      const result = await this.safeMath.add(a, b);
-      result.should.be.bignumber.equal(a.plus(b));
+      (await this.safeMath.add(a, b)).should.be.bignumber.equal(a.plus(b));
     });
 
     it('throws a revert error on addition overflow', async function () {
@@ -36,8 +35,7 @@ contract('SafeMath', () => {
       const a = new BigNumber(5678);
       const b = new BigNumber(1234);
 
-      const result = await this.safeMath.sub(a, b);
-      result.should.be.bignumber.equal(a.minus(b));
+      (await this.safeMath.sub(a, b)).should.be.bignumber.equal(a.minus(b));
     });
 
     it('throws a revert error if subtraction result would be negative', async function () {
@@ -53,16 +51,14 @@ contract('SafeMath', () => {
       const a = new BigNumber(1234);
       const b = new BigNumber(5678);
 
-      const result = await this.safeMath.mul(a, b);
-      result.should.be.bignumber.equal(a.times(b));
+      (await this.safeMath.mul(a, b)).should.be.bignumber.equal(a.times(b));
     });
 
     it('handles a zero product correctly', async function () {
       const a = new BigNumber(0);
       const b = new BigNumber(5678);
 
-      const result = await this.safeMath.mul(a, b);
-      result.should.be.bignumber.equal(a.times(b));
+      (await this.safeMath.mul(a, b)).should.be.bignumber.equal(a.times(b));
     });
 
     it('throws a revert error on multiplication overflow', async function () {
@@ -78,8 +74,7 @@ contract('SafeMath', () => {
       const a = new BigNumber(5678);
       const b = new BigNumber(5678);
 
-      const result = await this.safeMath.div(a, b);
-      result.should.be.bignumber.equal(a.div(b));
+      (await this.safeMath.div(a, b)).should.be.bignumber.equal(a.div(b));
     });
 
     it('throws a revert error on zero division', async function () {

+ 3 - 4
test/ownership/CanReclaimToken.test.js

@@ -20,17 +20,16 @@ contract('CanReclaimToken', function ([_, owner, anyone]) {
 
     // Force token into contract
     await token.transfer(canReclaimToken.address, 10, { from: owner });
-    const startBalance = await token.balanceOf(canReclaimToken.address);
-    startBalance.should.be.bignumber.equal(10);
+    (await token.balanceOf(canReclaimToken.address)).should.be.bignumber.equal(10);
   });
 
   it('should allow owner to reclaim tokens', async function () {
     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);
-    finalBalance.should.be.bignumber.equal(0);
     ownerFinalBalance.sub(ownerStartBalance).should.be.bignumber.equal(10);
+
+    (await token.balanceOf(canReclaimToken.address)).should.be.bignumber.equal(0);
   });
 
   it('should allow only owner to reclaim tokens', async function () {

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

@@ -16,15 +16,12 @@ contract('Claimable', function ([_, owner, newOwner, anyone]) {
   });
 
   it('should have an owner', async function () {
-    const owner = await claimable.owner();
-    owner.should.not.eq(0);
+    (await claimable.owner()).should.not.eq(0);
   });
 
   it('changes pendingOwner after transfer', async function () {
     await claimable.transferOwnership(newOwner, { from: owner });
-    const pendingOwner = await claimable.pendingOwner();
-
-    pendingOwner.should.eq(newOwner);
+    (await claimable.pendingOwner()).should.eq(newOwner);
   });
 
   it('should prevent to claimOwnership from anyone', async function () {

+ 2 - 4
test/ownership/Contactable.test.js

@@ -8,8 +8,7 @@ contract('Contactable', function () {
   });
 
   it('should have an empty contact info', async function () {
-    const info = await contactable.contactInformation();
-    info.should.eq('');
+    (await contactable.contactInformation()).should.eq('');
   });
 
   describe('after setting the contact information', function () {
@@ -20,8 +19,7 @@ contract('Contactable', function () {
     });
 
     it('should return the setted contact information', async function () {
-      const info = await contactable.contactInformation();
-      info.should.eq(contactInfo);
+      (await contactable.contactInformation()).should.eq(contactInfo);
     });
   });
 });

+ 6 - 12
test/ownership/DelayedClaimable.test.js

@@ -17,22 +17,18 @@ contract('DelayedClaimable', function ([_, owner, newOwner]) {
     await this.delayedClaimable.transferOwnership(newOwner, { from: owner });
     await this.delayedClaimable.setLimits(0, 1000, { from: owner });
 
-    const end = await this.delayedClaimable.end();
-    end.should.be.bignumber.equal(1000);
+    (await this.delayedClaimable.end()).should.be.bignumber.equal(1000);
 
-    const start = await this.delayedClaimable.start();
-    start.should.be.bignumber.equal(0);
+    (await this.delayedClaimable.start()).should.be.bignumber.equal(0);
   });
 
   it('changes pendingOwner after transfer successful', async function () {
     await this.delayedClaimable.transferOwnership(newOwner, { from: owner });
     await this.delayedClaimable.setLimits(0, 1000, { from: owner });
 
-    const end = await this.delayedClaimable.end();
-    end.should.be.bignumber.equal(1000);
+    (await this.delayedClaimable.end()).should.be.bignumber.equal(1000);
 
-    const start = await this.delayedClaimable.start();
-    start.should.be.bignumber.equal(0);
+    (await this.delayedClaimable.start()).should.be.bignumber.equal(0);
 
     (await this.delayedClaimable.pendingOwner()).should.eq(newOwner);
     await this.delayedClaimable.claimOwnership({ from: newOwner });
@@ -43,11 +39,9 @@ contract('DelayedClaimable', function ([_, owner, newOwner]) {
     await this.delayedClaimable.transferOwnership(newOwner, { from: owner });
     await this.delayedClaimable.setLimits(100, 110, { from: owner });
 
-    const end = await this.delayedClaimable.end();
-    end.should.be.bignumber.equal(110);
+    (await this.delayedClaimable.end()).should.be.bignumber.equal(110);
 
-    const start = await this.delayedClaimable.start();
-    start.should.be.bignumber.equal(100);
+    (await this.delayedClaimable.start()).should.be.bignumber.equal(100);
 
     (await this.delayedClaimable.pendingOwner()).should.eq(newOwner);
     await assertRevert(this.delayedClaimable.claimOwnership({ from: newOwner }));

+ 4 - 7
test/ownership/HasNoEther.test.js

@@ -38,25 +38,22 @@ contract('HasNoEther', function ([_, owner, anyone]) {
     // Force ether into it
     const forceEther = await ForceEther.new({ value: amount });
     await forceEther.destroyAndSend(this.hasNoEther.address);
-    const forcedBalance = await ethGetBalance(this.hasNoEther.address);
-    forcedBalance.should.be.bignumber.equal(amount);
+    (await ethGetBalance(this.hasNoEther.address)).should.be.bignumber.equal(amount);
 
     // Reclaim
     const ownerStartBalance = await ethGetBalance(owner);
     await this.hasNoEther.reclaimEther({ from: owner });
     const ownerFinalBalance = await ethGetBalance(owner);
-    const finalBalance = await ethGetBalance(this.hasNoEther.address);
-    finalBalance.should.be.bignumber.equal(0);
-
     ownerFinalBalance.should.be.bignumber.gt(ownerStartBalance);
+
+    (await ethGetBalance(this.hasNoEther.address)).should.be.bignumber.equal(0);
   });
 
   it('should allow only owner to reclaim ether', async function () {
     // Force ether into it
     const forceEther = await ForceEther.new({ value: amount });
     await forceEther.destroyAndSend(this.hasNoEther.address);
-    const forcedBalance = await ethGetBalance(this.hasNoEther.address);
-    forcedBalance.should.be.bignumber.equal(amount);
+    (await ethGetBalance(this.hasNoEther.address)).should.be.bignumber.equal(amount);
 
     // Reclaim
     await expectThrow(this.hasNoEther.reclaimEther({ from: anyone }));

+ 3 - 5
test/ownership/HasNoTokens.test.js

@@ -21,8 +21,7 @@ contract('HasNoTokens', function ([_, owner, initialAccount, anyone]) {
     // Force token into contract
     await token.transfer(hasNoTokens.address, 10, { from: initialAccount });
 
-    const startBalance = await token.balanceOf(hasNoTokens.address);
-    startBalance.should.be.bignumber.equal(10);
+    (await token.balanceOf(hasNoTokens.address)).should.be.bignumber.equal(10);
   });
 
   it('should not accept ERC223 tokens', async function () {
@@ -34,10 +33,9 @@ contract('HasNoTokens', function ([_, owner, initialAccount, anyone]) {
     await hasNoTokens.reclaimToken(token.address, { from: owner });
 
     const ownerFinalBalance = await token.balanceOf(owner);
-    const finalBalance = await token.balanceOf(hasNoTokens.address);
-
-    finalBalance.should.be.bignumber.equal(0);
     ownerFinalBalance.sub(ownerStartBalance).should.be.bignumber.equal(10);
+
+    (await token.balanceOf(hasNoTokens.address)).should.be.bignumber.equal(0);
   });
 
   it('should allow only owner to reclaim tokens', async function () {

+ 5 - 10
test/ownership/Superuser.test.js

@@ -15,18 +15,15 @@ contract('Superuser', function ([_, firstOwner, newSuperuser, newOwner, anyone])
 
   context('in normal conditions', () => {
     it('should set the owner as the default superuser', async function () {
-      const ownerIsSuperuser = await this.superuser.isSuperuser(firstOwner);
-      ownerIsSuperuser.should.be.equal(true);
+      (await this.superuser.isSuperuser(firstOwner)).should.be.be.true;
     });
 
     it('should change superuser after transferring', async function () {
       await this.superuser.transferSuperuser(newSuperuser, { from: firstOwner });
 
-      const ownerIsSuperuser = await this.superuser.isSuperuser(firstOwner);
-      ownerIsSuperuser.should.be.equal(false);
+      (await this.superuser.isSuperuser(firstOwner)).should.be.be.false;
 
-      const newSuperuserIsSuperuser = await this.superuser.isSuperuser(newSuperuser);
-      newSuperuserIsSuperuser.should.be.equal(true);
+      (await this.superuser.isSuperuser(newSuperuser)).should.be.be.true;
     });
 
     it('should prevent changing to a null superuser', async function () {
@@ -43,8 +40,7 @@ contract('Superuser', function ([_, firstOwner, newSuperuser, newOwner, anyone])
         'OwnershipTransferred'
       );
 
-      const currentOwner = await this.superuser.owner();
-      currentOwner.should.be.equal(newOwner);
+      (await this.superuser.owner()).should.equal(newOwner);
     });
 
     it('should change owner after the owner transfers the ownership', async function () {
@@ -53,8 +49,7 @@ contract('Superuser', function ([_, firstOwner, newSuperuser, newOwner, anyone])
         'OwnershipTransferred'
       );
 
-      const currentOwner = await this.superuser.owner();
-      currentOwner.should.be.equal(newOwner);
+      (await this.superuser.owner()).should.equal(newOwner);
     });
   });
 

+ 4 - 8
test/ownership/Whitelist.test.js

@@ -21,8 +21,7 @@ contract('Whitelist', function ([_, owner, whitelistedAddress1, whitelistedAddre
         'RoleAdded',
         { role: this.role },
       );
-      const isWhitelisted = await this.mock.whitelist(whitelistedAddress1);
-      isWhitelisted.should.be.equal(true);
+      (await this.mock.whitelist(whitelistedAddress1)).should.be.be.true;
     });
 
     it('should add addresses to the whitelist', async function () {
@@ -32,8 +31,7 @@ contract('Whitelist', function ([_, owner, whitelistedAddress1, whitelistedAddre
         { role: this.role },
       );
       for (const addr of whitelistedAddresses) {
-        const isWhitelisted = await this.mock.whitelist(addr);
-        isWhitelisted.should.be.equal(true);
+        (await this.mock.whitelist(addr)).should.be.be.true;
       }
     });
 
@@ -43,8 +41,7 @@ contract('Whitelist', function ([_, owner, whitelistedAddress1, whitelistedAddre
         'RoleRemoved',
         { role: this.role },
       );
-      const isWhitelisted = await this.mock.whitelist(whitelistedAddress1);
-      isWhitelisted.should.be.equal(false);
+      (await this.mock.whitelist(whitelistedAddress1)).should.be.be.false;
     });
 
     it('should remove addresses from the the whitelist', async function () {
@@ -54,8 +51,7 @@ contract('Whitelist', function ([_, owner, whitelistedAddress1, whitelistedAddre
         { role: this.role },
       );
       for (const addr of whitelistedAddresses) {
-        const isWhitelisted = await this.mock.whitelist(addr);
-        isWhitelisted.should.be.equal(false);
+        (await this.mock.whitelist(addr)).should.be.be.false;
       }
     });
 

+ 12 - 19
test/payment/Escrow.behavior.js

@@ -17,11 +17,9 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) {
       it('can accept a single deposit', async function () {
         await this.escrow.deposit(payee1, { from: owner, value: amount });
 
-        const balance = await ethGetBalance(this.escrow.address);
-        const deposit = await this.escrow.depositsOf(payee1);
+        (await ethGetBalance(this.escrow.address)).should.be.bignumber.equal(amount);
 
-        balance.should.be.bignumber.equal(amount);
-        deposit.should.be.bignumber.equal(amount);
+        (await this.escrow.depositsOf(payee1)).should.be.bignumber.equal(amount);
       });
 
       it('can accept an empty deposit', async function () {
@@ -43,24 +41,20 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) {
         await this.escrow.deposit(payee1, { from: owner, value: amount });
         await this.escrow.deposit(payee1, { from: owner, value: amount * 2 });
 
-        const balance = await ethGetBalance(this.escrow.address);
-        const deposit = await this.escrow.depositsOf(payee1);
+        (await ethGetBalance(this.escrow.address)).should.be.bignumber.equal(amount * 3);
 
-        balance.should.be.bignumber.equal(amount * 3);
-        deposit.should.be.bignumber.equal(amount * 3);
+        (await this.escrow.depositsOf(payee1)).should.be.bignumber.equal(amount * 3);
       });
 
       it('can track deposits to multiple accounts', async function () {
         await this.escrow.deposit(payee1, { from: owner, value: amount });
         await this.escrow.deposit(payee2, { from: owner, value: amount * 2 });
 
-        const balance = await ethGetBalance(this.escrow.address);
-        const depositPayee1 = await this.escrow.depositsOf(payee1);
-        const depositPayee2 = await this.escrow.depositsOf(payee2);
+        (await ethGetBalance(this.escrow.address)).should.be.bignumber.equal(amount * 3);
 
-        balance.should.be.bignumber.equal(amount * 3);
-        depositPayee1.should.be.bignumber.equal(amount);
-        depositPayee2.should.be.bignumber.equal(amount * 2);
+        (await this.escrow.depositsOf(payee1)).should.be.bignumber.equal(amount);
+
+        (await this.escrow.depositsOf(payee2)).should.be.bignumber.equal(amount * 2);
       });
     });
 
@@ -71,12 +65,11 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) {
         await this.escrow.deposit(payee1, { from: owner, value: amount });
         await this.escrow.withdraw(payee1, { from: owner });
 
-        const escrowBalance = await ethGetBalance(this.escrow.address);
-        const finalDeposit = await this.escrow.depositsOf(payee1);
-        const payeeFinalBalance = await ethGetBalance(payee1);
+        (await ethGetBalance(this.escrow.address)).should.be.bignumber.equal(0);
 
-        escrowBalance.should.be.bignumber.equal(0);
-        finalDeposit.should.be.bignumber.equal(0);
+        (await this.escrow.depositsOf(payee1)).should.be.bignumber.equal(0);
+
+        const payeeFinalBalance = await ethGetBalance(payee1);
         payeeFinalBalance.sub(payeeInitialBalance).should.be.bignumber.equal(amount);
       });
 

+ 6 - 12
test/payment/PullPayment.test.js

@@ -17,26 +17,22 @@ contract('PullPayment', function ([_, payer, payee1, payee2]) {
 
   it('can record an async payment correctly', async function () {
     await this.contract.callTransfer(payee1, 100, { from: payer });
-    const paymentsToPayee1 = await this.contract.payments(payee1);
-    paymentsToPayee1.should.be.bignumber.equal(100);
+    (await this.contract.payments(payee1)).should.be.bignumber.equal(100);
   });
 
   it('can add multiple balances on one account', async function () {
     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);
+    (await this.contract.payments(payee1)).should.be.bignumber.equal(500);
   });
 
   it('can add balances on multiple accounts', async function () {
     await this.contract.callTransfer(payee1, 200, { from: payer });
     await this.contract.callTransfer(payee2, 300, { from: payer });
 
-    const paymentsToPayee1 = await this.contract.payments(payee1);
-    paymentsToPayee1.should.be.bignumber.equal(200);
+    (await this.contract.payments(payee1)).should.be.bignumber.equal(200);
 
-    const paymentsToPayee2 = await this.contract.payments(payee2);
-    paymentsToPayee2.should.be.bignumber.equal(300);
+    (await this.contract.payments(payee2)).should.be.bignumber.equal(300);
   });
 
   it('can withdraw payment', async function () {
@@ -44,12 +40,10 @@ contract('PullPayment', function ([_, payer, payee1, payee2]) {
 
     await this.contract.callTransfer(payee1, amount, { from: payer });
 
-    const payment1 = await this.contract.payments(payee1);
-    payment1.should.be.bignumber.equal(amount);
+    (await this.contract.payments(payee1)).should.be.bignumber.equal(amount);
 
     await this.contract.withdrawPayments({ from: payee1 });
-    const payment2 = await this.contract.payments(payee1);
-    payment2.should.be.bignumber.equal(0);
+    (await this.contract.payments(payee1)).should.be.bignumber.equal(0);
 
     const balance = await ethGetBalance(payee1);
     Math.abs(balance - initialBalance - amount).should.be.lt(1e16);

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

@@ -31,8 +31,7 @@ contract('RefundEscrow', function ([_, owner, beneficiary, refundee1, refundee2]
       it('accepts deposits', async function () {
         await this.escrow.deposit(refundee1, { from: owner, value: amount });
 
-        const deposit = await this.escrow.depositsOf(refundee1);
-        deposit.should.be.bignumber.equal(amount);
+        (await this.escrow.depositsOf(refundee1)).should.be.bignumber.equal(amount);
       });
 
       it('does not refund refundees', async function () {

+ 5 - 10
test/payment/SplitPayment.test.js

@@ -49,18 +49,15 @@ contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1,
     it('should accept payments', async function () {
       await ethSendTransaction({ from: owner, to: this.contract.address, value: amount });
 
-      const balance = await ethGetBalance(this.contract.address);
-      balance.should.be.bignumber.equal(amount);
+      (await ethGetBalance(this.contract.address)).should.be.bignumber.equal(amount);
     });
 
     it('should store shares if address is payee', async function () {
-      const shares = await this.contract.shares.call(payee1);
-      shares.should.be.bignumber.not.eq(0);
+      (await this.contract.shares.call(payee1)).should.be.bignumber.not.eq(0);
     });
 
     it('should not store shares if address is not payee', async function () {
-      const shares = await this.contract.shares.call(nonpayee1);
-      shares.should.be.bignumber.equal(0);
+      (await this.contract.shares.call(nonpayee1)).should.be.bignumber.equal(0);
     });
 
     it('should throw if no funds to claim', async function () {
@@ -96,12 +93,10 @@ contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1,
       profit3.sub(web3.toWei(0.70, 'ether')).abs().should.be.bignumber.lt(1e16);
 
       // end balance should be zero
-      const endBalance = await ethGetBalance(this.contract.address);
-      endBalance.should.be.bignumber.equal(0);
+      (await ethGetBalance(this.contract.address)).should.be.bignumber.equal(0);
 
       // check correct funds released accounting
-      const totalReleased = await this.contract.totalReleased.call();
-      totalReleased.should.be.bignumber.equal(initBalance);
+      (await this.contract.totalReleased.call()).should.be.bignumber.equal(initBalance);
     });
   });
 });

+ 1 - 2
test/proposals/ERC1046/TokenMetadata.test.js

@@ -11,7 +11,6 @@ describe('ERC20WithMetadata', function () {
   });
 
   it('responds with the metadata', async function () {
-    const got = await this.token.tokenURI();
-    got.should.eq(metadataURI);
+    (await this.token.tokenURI()).should.eq(metadataURI);
   });
 });

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

@@ -18,8 +18,7 @@ function shouldBehaveLikeBurnableToken (owner, initialBalance, [burner]) {
       });
 
       it('burns the requested amount', async function () {
-        const balance = await this.token.balanceOf(owner);
-        balance.should.be.bignumber.equal(initialBalance - amount);
+        (await this.token.balanceOf(owner)).should.be.bignumber.equal(initialBalance - amount);
       });
 
       it('emits a burn event', async function () {
@@ -56,13 +55,11 @@ function shouldBehaveLikeBurnableToken (owner, initialBalance, [burner]) {
       });
 
       it('burns the requested amount', async function () {
-        const balance = await this.token.balanceOf(owner);
-        balance.should.be.bignumber.equal(initialBalance - amount);
+        (await this.token.balanceOf(owner)).should.be.bignumber.equal(initialBalance - amount);
       });
 
       it('decrements allowance', async function () {
-        const allowance = await this.token.allowance(owner, burner);
-        allowance.should.be.bignumber.equal(200);
+        (await this.token.allowance(owner, burner)).should.be.bignumber.equal(200);
       });
 
       it('emits a burn event', async function () {

+ 3 - 6
test/token/ERC20/DetailedERC20.test.js

@@ -18,17 +18,14 @@ contract('DetailedERC20', function () {
   });
 
   it('has a name', async function () {
-    const name = await detailedERC20.name();
-    name.should.be.equal(_name);
+    (await detailedERC20.name()).should.be.equal(_name);
   });
 
   it('has a symbol', async function () {
-    const symbol = await detailedERC20.symbol();
-    symbol.should.be.equal(_symbol);
+    (await detailedERC20.symbol()).should.be.equal(_symbol);
   });
 
   it('has an amount of decimals', async function () {
-    const decimals = await detailedERC20.decimals();
-    decimals.should.be.bignumber.equal(_decimals);
+    (await detailedERC20.decimals()).should.be.bignumber.equal(_decimals);
   });
 });

+ 5 - 10
test/token/ERC20/MintableToken.behavior.js

@@ -13,16 +13,14 @@ 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 () {
-        const tokenOwner = await this.token.owner({ from: owner });
-        tokenOwner.should.eq(owner);
+        (await this.token.owner({ from: owner })).should.equal(owner);
       });
     });
 
     describe('minting finished', function () {
       describe('when the token minting is not finished', function () {
         it('returns false', async function () {
-          const mintingFinished = await this.token.mintingFinished();
-          mintingFinished.should.be.false;
+          (await this.token.mintingFinished()).should.be.false;
         });
       });
 
@@ -32,8 +30,7 @@ function shouldBehaveLikeMintableToken (owner, minter, [anyone]) {
         });
 
         it('returns true', async function () {
-          const mintingFinished = await this.token.mintingFinished();
-          mintingFinished.should.be.true;
+          (await this.token.mintingFinished()).should.be.true;
         });
       });
     });
@@ -46,8 +43,7 @@ function shouldBehaveLikeMintableToken (owner, minter, [anyone]) {
           it('finishes token minting', async function () {
             await this.token.finishMinting({ from });
 
-            const mintingFinished = await this.token.mintingFinished();
-            mintingFinished.should.be.true;
+            (await this.token.mintingFinished()).should.be.true;
           });
 
           it('emits a mint finished event', async function () {
@@ -100,8 +96,7 @@ function shouldBehaveLikeMintableToken (owner, minter, [anyone]) {
           it('mints the requested amount', async function () {
             await this.token.mint(owner, amount, { from });
 
-            const balance = await this.token.balanceOf(owner);
-            balance.should.be.bignumber.equal(amount);
+            (await this.token.balanceOf(owner)).should.be.bignumber.equal(amount);
           });
 
           it('emits a mint and a transfer event', async function () {

+ 19 - 47
test/token/ERC20/PausableToken.test.js

@@ -13,9 +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 });
-
-          const paused = await this.token.paused();
-          paused.should.be.true;
+          (await this.token.paused()).should.be.true;
         });
 
         it('emits a Pause event', async function () {
@@ -57,9 +55,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
 
         it('unpauses the token', async function () {
           await this.token.unpause({ from });
-
-          const paused = await this.token.paused();
-          paused.should.be.false;
+          (await this.token.paused()).should.be.false;
         });
 
         it('emits an Unpause event', async function () {
@@ -91,24 +87,18 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
 
     describe('paused', function () {
       it('is not paused by default', async function () {
-        const paused = await this.token.paused({ from });
-
-        paused.should.be.false;
+        (await this.token.paused({ from })).should.be.false;
       });
 
       it('is paused after being paused', async function () {
         await this.token.pause({ from });
-        const paused = await this.token.paused({ from });
-
-        paused.should.be.true;
+        (await this.token.paused({ from })).should.be.true;
       });
 
       it('is not paused after being paused and then unpaused', async function () {
         await this.token.pause({ from });
         await this.token.unpause({ from });
-        const paused = await this.token.paused();
-
-        paused.should.be.false;
+        (await this.token.paused()).should.be.false;
       });
     });
 
@@ -116,11 +106,8 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
       it('allows to transfer when unpaused', async function () {
         await this.token.transfer(recipient, 100, { from: owner });
 
-        const senderBalance = await this.token.balanceOf(owner);
-        senderBalance.should.be.bignumber.equal(0);
-
-        const recipientBalance = await this.token.balanceOf(recipient);
-        recipientBalance.should.be.bignumber.equal(100);
+        (await this.token.balanceOf(owner)).should.be.bignumber.equal(0);
+        (await this.token.balanceOf(recipient)).should.be.bignumber.equal(100);
       });
 
       it('allows to transfer when paused and then unpaused', async function () {
@@ -129,11 +116,8 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
 
         await this.token.transfer(recipient, 100, { from: owner });
 
-        const senderBalance = await this.token.balanceOf(owner);
-        senderBalance.should.be.bignumber.equal(0);
-
-        const recipientBalance = await this.token.balanceOf(recipient);
-        recipientBalance.should.be.bignumber.equal(100);
+        (await this.token.balanceOf(owner)).should.be.bignumber.equal(0);
+        (await this.token.balanceOf(recipient)).should.be.bignumber.equal(100);
       });
 
       it('reverts when trying to transfer when paused', async function () {
@@ -147,8 +131,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
       it('allows to approve when unpaused', async function () {
         await this.token.approve(anotherAccount, 40, { from: owner });
 
-        const allowance = await this.token.allowance(owner, anotherAccount);
-        allowance.should.be.bignumber.equal(40);
+        (await this.token.allowance(owner, anotherAccount)).should.be.bignumber.equal(40);
       });
 
       it('allows to transfer when paused and then unpaused', async function () {
@@ -157,8 +140,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
 
         await this.token.approve(anotherAccount, 40, { from: owner });
 
-        const allowance = await this.token.allowance(owner, anotherAccount);
-        allowance.should.be.bignumber.equal(40);
+        (await this.token.allowance(owner, anotherAccount)).should.be.bignumber.equal(40);
       });
 
       it('reverts when trying to transfer when paused', async function () {
@@ -176,11 +158,8 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
       it('allows to transfer from when unpaused', async function () {
         await this.token.transferFrom(owner, recipient, 40, { from: anotherAccount });
 
-        const senderBalance = await this.token.balanceOf(owner);
-        senderBalance.should.be.bignumber.equal(60);
-
-        const recipientBalance = await this.token.balanceOf(recipient);
-        recipientBalance.should.be.bignumber.equal(40);
+        (await this.token.balanceOf(owner)).should.be.bignumber.equal(60);
+        (await this.token.balanceOf(recipient)).should.be.bignumber.equal(40);
       });
 
       it('allows to transfer when paused and then unpaused', async function () {
@@ -189,11 +168,8 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
 
         await this.token.transferFrom(owner, recipient, 40, { from: anotherAccount });
 
-        const senderBalance = await this.token.balanceOf(owner);
-        senderBalance.should.be.bignumber.equal(60);
-
-        const recipientBalance = await this.token.balanceOf(recipient);
-        recipientBalance.should.be.bignumber.equal(40);
+        (await this.token.balanceOf(owner)).should.be.bignumber.equal(60);
+        (await this.token.balanceOf(recipient)).should.be.bignumber.equal(40);
       });
 
       it('reverts when trying to transfer from when paused', async function () {
@@ -211,8 +187,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
       it('allows to decrease approval when unpaused', async function () {
         await this.token.decreaseApproval(anotherAccount, 40, { from: owner });
 
-        const allowance = await this.token.allowance(owner, anotherAccount);
-        allowance.should.be.bignumber.equal(60);
+        (await this.token.allowance(owner, anotherAccount)).should.be.bignumber.equal(60);
       });
 
       it('allows to decrease approval when paused and then unpaused', async function () {
@@ -221,8 +196,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
 
         await this.token.decreaseApproval(anotherAccount, 40, { from: owner });
 
-        const allowance = await this.token.allowance(owner, anotherAccount);
-        allowance.should.be.bignumber.equal(60);
+        (await this.token.allowance(owner, anotherAccount)).should.be.bignumber.equal(60);
       });
 
       it('reverts when trying to transfer when paused', async function () {
@@ -240,8 +214,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
       it('allows to increase approval when unpaused', async function () {
         await this.token.increaseApproval(anotherAccount, 40, { from: owner });
 
-        const allowance = await this.token.allowance(owner, anotherAccount);
-        allowance.should.be.bignumber.equal(140);
+        (await this.token.allowance(owner, anotherAccount)).should.be.bignumber.equal(140);
       });
 
       it('allows to increase approval when paused and then unpaused', async function () {
@@ -250,8 +223,7 @@ contract('PausableToken', function ([_, owner, recipient, anotherAccount]) {
 
         await this.token.increaseApproval(anotherAccount, 40, { from: owner });
 
-        const allowance = await this.token.allowance(owner, anotherAccount);
-        allowance.should.be.bignumber.equal(140);
+        (await this.token.allowance(owner, anotherAccount)).should.be.bignumber.equal(140);
       });
 
       it('reverts when trying to increase approval when paused', async function () {

+ 2 - 4
test/token/ERC20/RBACMintableToken.behavior.js

@@ -6,12 +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 });
-      let hasRole = await this.token.hasRole(anyone, ROLE_MINTER);
-      hasRole.should.be.true;
+      (await this.token.hasRole(anyone, ROLE_MINTER)).should.be.true;
 
       await this.token.removeMinter(anyone, { from: owner });
-      hasRole = await this.token.hasRole(anyone, ROLE_MINTER);
-      hasRole.should.be.false;
+      (await this.token.hasRole(anyone, ROLE_MINTER)).should.be.false;
     });
 
     it('anyone can\'t add or remove a minter role', async function () {

+ 25 - 53
test/token/ERC20/StandardToken.test.js

@@ -18,26 +18,20 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
 
   describe('total supply', function () {
     it('returns the total amount of tokens', async function () {
-      const totalSupply = await this.token.totalSupply();
-
-      totalSupply.should.be.bignumber.equal(100);
+      (await this.token.totalSupply()).should.be.bignumber.equal(100);
     });
   });
 
   describe('balanceOf', function () {
     describe('when the requested account has no tokens', function () {
       it('returns zero', async function () {
-        const balance = await this.token.balanceOf(anotherAccount);
-
-        balance.should.be.bignumber.equal(0);
+        (await this.token.balanceOf(anotherAccount)).should.be.bignumber.equal(0);
       });
     });
 
     describe('when the requested account has some tokens', function () {
       it('returns the total amount of tokens', async function () {
-        const balance = await this.token.balanceOf(owner);
-
-        balance.should.be.bignumber.equal(100);
+        (await this.token.balanceOf(owner)).should.be.bignumber.equal(100);
       });
     });
   });
@@ -60,11 +54,9 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
         it('transfers the requested amount', async function () {
           await this.token.transfer(to, amount, { from: owner });
 
-          const senderBalance = await this.token.balanceOf(owner);
-          senderBalance.should.be.bignumber.equal(0);
+          (await this.token.balanceOf(owner)).should.be.bignumber.equal(0);
 
-          const recipientBalance = await this.token.balanceOf(to);
-          recipientBalance.should.be.bignumber.equal(amount);
+          (await this.token.balanceOf(to)).should.be.bignumber.equal(amount);
         });
 
         it('emits a transfer event', async function () {
@@ -110,8 +102,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('approves the requested amount', async function () {
             await this.token.approve(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(amount);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
           });
         });
 
@@ -123,8 +114,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('approves the requested amount and replaces the previous one', async function () {
             await this.token.approve(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(amount);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
           });
         });
       });
@@ -146,8 +136,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('approves the requested amount', async function () {
             await this.token.approve(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(amount);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
           });
         });
 
@@ -159,8 +148,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('approves the requested amount and replaces the previous one', async function () {
             await this.token.approve(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(amount);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
           });
         });
       });
@@ -173,8 +161,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
       it('approves the requested amount', async function () {
         await this.token.approve(spender, amount, { from: owner });
 
-        const allowance = await this.token.allowance(owner, spender);
-        allowance.should.be.bignumber.equal(amount);
+        (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
       });
 
       it('emits an approval event', async function () {
@@ -206,18 +193,15 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('transfers the requested amount', async function () {
             await this.token.transferFrom(owner, to, amount, { from: spender });
 
-            const senderBalance = await this.token.balanceOf(owner);
-            senderBalance.should.be.bignumber.equal(0);
+            (await this.token.balanceOf(owner)).should.be.bignumber.equal(0);
 
-            const recipientBalance = await this.token.balanceOf(to);
-            recipientBalance.should.be.bignumber.equal(amount);
+            (await this.token.balanceOf(to)).should.be.bignumber.equal(amount);
           });
 
           it('decreases the spender allowance', async function () {
             await this.token.transferFrom(owner, to, amount, { from: spender });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(0);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
           });
 
           it('emits a transfer event', async function () {
@@ -298,8 +282,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('keeps the allowance to zero', async function () {
             await this.token.decreaseApproval(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(0);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
           });
         });
 
@@ -313,20 +296,17 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('decreases the spender allowance subtracting the requested amount', async function () {
             await this.token.decreaseApproval(spender, approvedAmount - 5, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(5);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(5);
           });
 
           it('sets the allowance to zero when all allowance is removed', async function () {
             await this.token.decreaseApproval(spender, approvedAmount, { from: owner });
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(0);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
           });
 
           it('sets the allowance to zero when more than the full allowance is removed', async function () {
             await this.token.decreaseApproval(spender, approvedAmount + 5, { from: owner });
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(0);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
           });
         });
       });
@@ -348,8 +328,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('keeps the allowance to zero', async function () {
             await this.token.decreaseApproval(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(0);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
           });
         });
 
@@ -361,8 +340,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('decreases the spender allowance subtracting the requested amount', async function () {
             await this.token.decreaseApproval(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(1);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(1);
           });
         });
       });
@@ -375,8 +353,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
       it('decreases the requested amount', async function () {
         await this.token.decreaseApproval(spender, amount, { from: owner });
 
-        const allowance = await this.token.allowance(owner, spender);
-        allowance.should.be.bignumber.equal(0);
+        (await this.token.allowance(owner, spender)).should.be.bignumber.equal(0);
       });
 
       it('emits an approval event', async function () {
@@ -412,8 +389,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('approves the requested amount', async function () {
             await this.token.increaseApproval(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(amount);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
           });
         });
 
@@ -425,8 +401,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('increases the spender allowance adding the requested amount', async function () {
             await this.token.increaseApproval(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(amount + 1);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount + 1);
           });
         });
       });
@@ -448,8 +423,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('approves the requested amount', async function () {
             await this.token.increaseApproval(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(amount);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
           });
         });
 
@@ -461,8 +435,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
           it('increases the spender allowance adding the requested amount', async function () {
             await this.token.increaseApproval(spender, amount, { from: owner });
 
-            const allowance = await this.token.allowance(owner, spender);
-            allowance.should.be.bignumber.equal(amount + 1);
+            (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount + 1);
           });
         });
       });
@@ -474,8 +447,7 @@ contract('StandardToken', function ([_, owner, recipient, anotherAccount]) {
       it('approves the requested amount', async function () {
         await this.token.increaseApproval(spender, amount, { from: owner });
 
-        const allowance = await this.token.allowance(owner, spender);
-        allowance.should.be.bignumber.equal(amount);
+        (await this.token.allowance(owner, spender)).should.be.bignumber.equal(amount);
       });
 
       it('emits an approval event', async function () {

+ 3 - 6
test/token/ERC20/TokenTimelock.test.js

@@ -45,23 +45,20 @@ contract('TokenTimelock', function ([_, owner, beneficiary]) {
       it('can be released just after limit', async function () {
         await increaseTimeTo(this.releaseTime + duration.seconds(1));
         await this.timelock.release();
-        const balance = await this.token.balanceOf(beneficiary);
-        balance.should.be.bignumber.equal(amount);
+        (await this.token.balanceOf(beneficiary)).should.be.bignumber.equal(amount);
       });
 
       it('can be released after time limit', async function () {
         await increaseTimeTo(this.releaseTime + duration.years(1));
         await this.timelock.release();
-        const balance = await this.token.balanceOf(beneficiary);
-        balance.should.be.bignumber.equal(amount);
+        (await this.token.balanceOf(beneficiary)).should.be.bignumber.equal(amount);
       });
 
       it('cannot be released twice', async function () {
         await increaseTimeTo(this.releaseTime + duration.years(1));
         await this.timelock.release();
         await expectThrow(this.timelock.release());
-        const balance = await this.token.balanceOf(beneficiary);
-        balance.should.be.bignumber.equal(amount);
+        (await this.token.balanceOf(beneficiary)).should.be.bignumber.equal(amount);
       });
     });
   });

+ 6 - 9
test/token/ERC20/TokenVesting.test.js

@@ -67,8 +67,9 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
       const block = await ethGetBlock(receipt.blockNumber);
       const releaseTime = block.timestamp;
 
-      const balance = await this.token.balanceOf(beneficiary);
-      balance.should.bignumber.eq(amount.mul(releaseTime - this.start).div(this.duration).floor());
+      (await this.token.balanceOf(beneficiary)).should.bignumber.eq(
+        amount.mul(releaseTime - this.start).div(this.duration).floor()
+      );
     });
 
     it('should linearly release tokens during vesting period', async function () {
@@ -80,18 +81,15 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
         await increaseTimeTo(now);
 
         await this.vesting.release(this.token.address);
-        const balance = await this.token.balanceOf(beneficiary);
         const expectedVesting = amount.mul(now - this.start).div(this.duration).floor();
-
-        balance.should.bignumber.eq(expectedVesting);
+        (await this.token.balanceOf(beneficiary)).should.bignumber.eq(expectedVesting);
       }
     });
 
     it('should have released all after end', async function () {
       await increaseTimeTo(this.start + this.duration);
       await this.vesting.release(this.token.address);
-      const balance = await this.token.balanceOf(beneficiary);
-      balance.should.bignumber.eq(amount);
+      (await this.token.balanceOf(beneficiary)).should.bignumber.eq(amount);
     });
 
     it('should be revoked by owner if revocable is set', async function () {
@@ -116,8 +114,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
 
       await this.vesting.revoke(this.token.address, { from: owner });
 
-      const ownerBalance = await this.token.balanceOf(owner);
-      ownerBalance.should.bignumber.eq(amount.sub(vested));
+      (await this.token.balanceOf(owner)).should.bignumber.eq(amount.sub(vested));
     });
 
     it('should keep the vested tokens when revoked by owner', async function () {

+ 18 - 36
test/token/ERC721/ERC721BasicToken.behavior.js

@@ -28,15 +28,13 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
     describe('balanceOf', function () {
       context('when the given address owns some tokens', function () {
         it('returns the amount of tokens owned by the given address', async function () {
-          const balance = await this.token.balanceOf(creator);
-          balance.should.be.bignumber.equal(2);
+          (await this.token.balanceOf(creator)).should.be.bignumber.equal(2);
         });
       });
 
       context('when the given address does not own any tokens', function () {
         it('returns 0', async function () {
-          const balance = await this.token.balanceOf(accounts[1]);
-          balance.should.be.bignumber.equal(0);
+          (await this.token.balanceOf(accounts[1])).should.be.bignumber.equal(0);
         });
       });
 
@@ -52,8 +50,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
         const tokenId = firstTokenId;
 
         it('returns the owner of the given token ID', async function () {
-          const owner = await this.token.ownerOf(tokenId);
-          owner.should.be.equal(creator);
+          (await this.token.ownerOf(tokenId)).should.be.equal(creator);
         });
       });
 
@@ -84,13 +81,11 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
 
       const transferWasSuccessful = function ({ owner, tokenId, approved }) {
         it('transfers the ownership of the given token ID to the given address', async function () {
-          const newOwner = await this.token.ownerOf(tokenId);
-          newOwner.should.be.equal(this.to);
+          (await this.token.ownerOf(tokenId)).should.be.equal(this.to);
         });
 
         it('clears the approval for the token ID', async function () {
-          const approvedAccount = await this.token.getApproved(tokenId);
-          approvedAccount.should.be.equal(ZERO_ADDRESS);
+          (await this.token.getApproved(tokenId)).should.be.equal(ZERO_ADDRESS);
         });
 
         if (approved) {
@@ -112,21 +107,17 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
         }
 
         it('adjusts owners balances', async function () {
-          const newOwnerBalance = await this.token.balanceOf(this.to);
-          newOwnerBalance.should.be.bignumber.equal(1);
+          (await this.token.balanceOf(this.to)).should.be.bignumber.equal(1);
 
-          const previousOwnerBalance = await this.token.balanceOf(owner);
-          previousOwnerBalance.should.be.bignumber.equal(1);
+          (await this.token.balanceOf(owner)).should.be.bignumber.equal(1);
         });
 
         it('adjusts owners tokens by index', async function () {
           if (!this.token.tokenOfOwnerByIndex) return;
 
-          const newOwnerToken = await this.token.tokenOfOwnerByIndex(this.to, 0);
-          newOwnerToken.toNumber().should.be.equal(tokenId);
+          (await this.token.tokenOfOwnerByIndex(this.to, 0)).toNumber().should.be.equal(tokenId);
 
-          const previousOwnerToken = await this.token.tokenOfOwnerByIndex(owner, 0);
-          previousOwnerToken.toNumber().should.not.be.eq(tokenId);
+          (await this.token.tokenOfOwnerByIndex(owner, 0)).toNumber().should.not.be.eq(tokenId);
         });
       };
 
@@ -166,13 +157,11 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
           });
 
           it('keeps ownership of the token', async function () {
-            const newOwner = await this.token.ownerOf(tokenId);
-            newOwner.should.be.equal(owner);
+            (await this.token.ownerOf(tokenId)).should.be.equal(owner);
           });
 
           it('clears the approval for the token ID', async function () {
-            const approvedAccount = await this.token.getApproved(tokenId);
-            approvedAccount.should.be.equal(ZERO_ADDRESS);
+            (await this.token.getApproved(tokenId)).should.be.equal(ZERO_ADDRESS);
           });
 
           it('emits only a transfer event', async function () {
@@ -184,8 +173,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
           });
 
           it('keeps the owner balance', async function () {
-            const ownerBalance = await this.token.balanceOf(owner);
-            ownerBalance.should.be.bignumber.equal(2);
+            (await this.token.balanceOf(owner)).should.be.bignumber.equal(2);
           });
 
           it('keeps same tokens by index', async function () {
@@ -332,15 +320,13 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
 
       const itClearsApproval = function () {
         it('clears approval for the token', async function () {
-          const approvedAccount = await this.token.getApproved(tokenId);
-          approvedAccount.should.be.equal(ZERO_ADDRESS);
+          (await this.token.getApproved(tokenId)).should.be.equal(ZERO_ADDRESS);
         });
       };
 
       const itApproves = function (address) {
         it('sets the approval for the target address', async function () {
-          const approvedAccount = await this.token.getApproved(tokenId);
-          approvedAccount.should.be.equal(address);
+          (await this.token.getApproved(tokenId)).should.be.equal(address);
         });
       };
 
@@ -453,8 +439,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
           it('approves the operator', async function () {
             await this.token.setApprovalForAll(operator, true, { from: sender });
 
-            const isApproved = await this.token.isApprovedForAll(sender, operator);
-            isApproved.should.be.true;
+            (await this.token.isApprovedForAll(sender, operator)).should.be.true;
           });
 
           it('emits an approval event', async function () {
@@ -476,8 +461,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
           it('approves the operator', async function () {
             await this.token.setApprovalForAll(operator, true, { from: sender });
 
-            const isApproved = await this.token.isApprovedForAll(sender, operator);
-            isApproved.should.be.true;
+            (await this.token.isApprovedForAll(sender, operator)).should.be.true;
           });
 
           it('emits an approval event', async function () {
@@ -493,8 +477,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
           it('can unset the operator approval', async function () {
             await this.token.setApprovalForAll(operator, false, { from: sender });
 
-            const isApproved = await this.token.isApprovedForAll(sender, operator);
-            isApproved.should.be.false;
+            (await this.token.isApprovedForAll(sender, operator)).should.be.false;
           });
         });
 
@@ -506,8 +489,7 @@ function shouldBehaveLikeERC721BasicToken (accounts) {
           it('keeps the approval to the given address', async function () {
             await this.token.setApprovalForAll(operator, true, { from: sender });
 
-            const isApproved = await this.token.isApprovedForAll(sender, operator);
-            isApproved.should.be.true;
+            (await this.token.isApprovedForAll(sender, operator)).should.be.true;
           });
 
           it('emits an approval event', async function () {

+ 4 - 8
test/token/ERC721/ERC721MintBurn.behavior.js

@@ -30,13 +30,11 @@ function shouldBehaveLikeMintAndBurnERC721Token (accounts) {
         });
 
         it('assigns the token to the new owner', async function () {
-          const owner = await this.token.ownerOf(tokenId);
-          owner.should.be.equal(to);
+          (await this.token.ownerOf(tokenId)).should.be.equal(to);
         });
 
         it('increases the balance of its owner', async function () {
-          const balance = await this.token.balanceOf(to);
-          balance.should.be.bignumber.equal(1);
+          (await this.token.balanceOf(to)).should.be.bignumber.equal(1);
         });
 
         it('emits a transfer event', async function () {
@@ -74,8 +72,7 @@ function shouldBehaveLikeMintAndBurnERC721Token (accounts) {
 
         it('burns the given token ID and adjusts the balance of the owner', async function () {
           await assertRevert(this.token.ownerOf(tokenId));
-          const balance = await this.token.balanceOf(sender);
-          balance.should.be.bignumber.equal(1);
+          (await this.token.balanceOf(sender)).should.be.bignumber.equal(1);
         });
 
         it('emits a burn event', async function () {
@@ -95,8 +92,7 @@ function shouldBehaveLikeMintAndBurnERC721Token (accounts) {
         });
 
         it('clears the approval', async function () {
-          const approvedAccount = await this.token.getApproved(tokenId);
-          approvedAccount.should.be.equal(ZERO_ADDRESS);
+          (await this.token.getApproved(tokenId)).should.be.equal(ZERO_ADDRESS);
         });
       });
 

+ 18 - 36
test/token/ERC721/ERC721Token.test.js

@@ -42,13 +42,11 @@ contract('ERC721Token', function (accounts) {
       });
 
       it('adjusts owner tokens by index', async function () {
-        const token = await this.token.tokenOfOwnerByIndex(to, 0);
-        token.toNumber().should.be.equal(tokenId);
+        (await this.token.tokenOfOwnerByIndex(to, 0)).toNumber().should.be.equal(tokenId);
       });
 
       it('adjusts all tokens list', async function () {
-        const newToken = await this.token.tokenByIndex(2);
-        newToken.toNumber().should.be.equal(tokenId);
+        (await this.token.tokenByIndex(2)).toNumber().should.be.equal(tokenId);
       });
     });
 
@@ -61,19 +59,16 @@ contract('ERC721Token', function (accounts) {
       });
 
       it('removes that token from the token list of the owner', async function () {
-        const token = await this.token.tokenOfOwnerByIndex(sender, 0);
-        token.toNumber().should.be.equal(secondTokenId);
+        (await this.token.tokenOfOwnerByIndex(sender, 0)).toNumber().should.be.equal(secondTokenId);
       });
 
       it('adjusts all tokens list', async function () {
-        const token = await this.token.tokenByIndex(0);
-        token.toNumber().should.be.equal(secondTokenId);
+        (await this.token.tokenByIndex(0)).toNumber().should.be.equal(secondTokenId);
       });
 
       it('burns all tokens', async function () {
         await this.token.burn(secondTokenId, { from: sender });
-        const total = await this.token.totalSupply();
-        total.toNumber().should.be.equal(0);
+        (await this.token.totalSupply()).toNumber().should.be.equal(0);
         await assertRevert(this.token.tokenByIndex(0));
       });
     });
@@ -95,18 +90,15 @@ contract('ERC721Token', function (accounts) {
         });
 
         it('adjusts token list', async function () {
-          const token = await this.token.tokenOfOwnerByIndex(creator, 0);
-          token.toNumber().should.be.equal(secondTokenId);
+          (await this.token.tokenOfOwnerByIndex(creator, 0)).toNumber().should.be.equal(secondTokenId);
         });
 
         it('adjusts owner count', async function () {
-          const count = await this.token.balanceOf(creator);
-          count.toNumber().should.be.equal(1);
+          (await this.token.balanceOf(creator)).toNumber().should.be.equal(1);
         });
 
         it('does not adjust supply', async function () {
-          const total = await this.token.totalSupply();
-          total.toNumber().should.be.equal(2);
+          (await this.token.totalSupply()).toNumber().should.be.equal(2);
         });
       });
     });
@@ -115,19 +107,16 @@ contract('ERC721Token', function (accounts) {
       const sampleUri = 'mock://mytoken';
 
       it('has a name', async function () {
-        const tokenName = await this.token.name();
-        tokenName.should.be.equal(name);
+        (await this.token.name()).should.be.equal(name);
       });
 
       it('has a symbol', async function () {
-        const tokenSymbol = await this.token.symbol();
-        tokenSymbol.should.be.equal(symbol);
+        (await this.token.symbol()).should.be.equal(symbol);
       });
 
       it('sets and returns metadata for a token id', async function () {
         await this.token.setTokenURI(firstTokenId, sampleUri);
-        const uri = await this.token.tokenURI(firstTokenId);
-        uri.should.be.equal(sampleUri);
+        (await this.token.tokenURI(firstTokenId)).should.be.equal(sampleUri);
       });
 
       it('reverts when setting metadata for non existent token id', async function () {
@@ -137,13 +126,11 @@ contract('ERC721Token', function (accounts) {
       it('can burn token with metadata', async function () {
         await this.token.setTokenURI(firstTokenId, sampleUri);
         await this.token.burn(firstTokenId);
-        const exists = await this.token.exists(firstTokenId);
-        exists.should.be.false;
+        (await this.token.exists(firstTokenId)).should.be.false;
       });
 
       it('returns empty metadata for token', async function () {
-        const uri = await this.token.tokenURI(firstTokenId);
-        uri.should.be.equal('');
+        (await this.token.tokenURI(firstTokenId)).should.be.equal('');
       });
 
       it('reverts when querying metadata for non existent token id', async function () {
@@ -153,8 +140,7 @@ contract('ERC721Token', function (accounts) {
 
     describe('totalSupply', function () {
       it('returns total token supply', async function () {
-        const totalSupply = await this.token.totalSupply();
-        totalSupply.should.be.bignumber.equal(2);
+        (await this.token.totalSupply()).should.be.bignumber.equal(2);
       });
     });
 
@@ -164,8 +150,7 @@ contract('ERC721Token', function (accounts) {
 
       describe('when the given index is lower than the amount of tokens owned by the given address', function () {
         it('returns the token ID placed at the given index', async function () {
-          const tokenId = await this.token.tokenOfOwnerByIndex(owner, 0);
-          tokenId.should.be.bignumber.equal(firstTokenId);
+          (await this.token.tokenOfOwnerByIndex(owner, 0)).should.be.bignumber.equal(firstTokenId);
         });
       });
 
@@ -188,15 +173,13 @@ contract('ERC721Token', function (accounts) {
         });
 
         it('returns correct token IDs for target', async function () {
-          const count = await this.token.balanceOf(another);
-          count.toNumber().should.be.equal(2);
+          (await this.token.balanceOf(another)).toNumber().should.be.equal(2);
           const tokensListed = await Promise.all(_.range(2).map(i => this.token.tokenOfOwnerByIndex(another, i)));
           tokensListed.map(t => t.toNumber()).should.have.members([firstTokenId, secondTokenId]);
         });
 
         it('returns empty collection for original owner', async function () {
-          const count = await this.token.balanceOf(owner);
-          count.toNumber().should.be.equal(0);
+          (await this.token.balanceOf(owner)).toNumber().should.be.equal(0);
           await assertRevert(this.token.tokenOfOwnerByIndex(owner, 0));
         });
       });
@@ -222,8 +205,7 @@ contract('ERC721Token', function (accounts) {
           await this.token.mint(owner, newTokenId, { from: owner });
           await this.token.mint(owner, anotherNewTokenId, { from: owner });
 
-          const count = await this.token.totalSupply();
-          count.toNumber().should.be.equal(3);
+          (await this.token.totalSupply()).toNumber().should.be.equal(3);
 
           const tokensListed = await Promise.all(_.range(3).map(i => this.token.tokenByIndex(i)));
           const expectedTokens = _.filter(