Prefer const in test files (#1117)

* Removed all instances of var.

* Sorted eslintrc rules.

* Made eslint rule severity explicit.

* Now prefering const over let.
This commit is contained in:
Nicolás Venturo
2018-07-26 13:25:10 -03:00
committed by GitHub
parent 6e19ed47be
commit 567b773242
31 changed files with 171 additions and 176 deletions

View File

@ -1,37 +1,39 @@
const { ethGetBalance } = require('../helpers/web3');
var TokenDestructible = artifacts.require('TokenDestructible');
var StandardTokenMock = artifacts.require('StandardTokenMock');
const TokenDestructible = artifacts.require('TokenDestructible');
const StandardTokenMock = artifacts.require('StandardTokenMock');
contract('TokenDestructible', function (accounts) {
let destructible;
let tokenDestructible;
let owner;
beforeEach(async function () {
destructible = await TokenDestructible.new({
tokenDestructible = await TokenDestructible.new({
from: accounts[0],
value: web3.toWei('10', 'ether'),
});
owner = await destructible.owner();
owner = await tokenDestructible.owner();
});
it('should send balance to owner after destruction', async function () {
let initBalance = await ethGetBalance(owner);
await destructible.destroy([], { from: owner });
let newBalance = await ethGetBalance(owner);
const initBalance = await ethGetBalance(owner);
await tokenDestructible.destroy([], { from: owner });
const newBalance = await ethGetBalance(owner);
assert.isTrue(newBalance > initBalance);
});
it('should send tokens to owner after destruction', async function () {
let token = await StandardTokenMock.new(destructible.address, 100);
let initContractBalance = await token.balanceOf(destructible.address);
let initOwnerBalance = await token.balanceOf(owner);
const token = await StandardTokenMock.new(tokenDestructible.address, 100);
const initContractBalance = await token.balanceOf(tokenDestructible.address);
const initOwnerBalance = await token.balanceOf(owner);
assert.equal(initContractBalance, 100);
assert.equal(initOwnerBalance, 0);
await destructible.destroy([token.address], { from: owner });
let newContractBalance = await token.balanceOf(destructible.address);
let newOwnerBalance = await token.balanceOf(owner);
await tokenDestructible.destroy([token.address], { from: owner });
const newContractBalance = await token.balanceOf(tokenDestructible.address);
const newOwnerBalance = await token.balanceOf(owner);
assert.equal(newContractBalance, 0);
assert.equal(newOwnerBalance, 100);
});