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,55 +1,51 @@
const { assertRevert } = require('../helpers/assertRevert');
var DelayedClaimable = artifacts.require('DelayedClaimable');
const DelayedClaimable = artifacts.require('DelayedClaimable');
contract('DelayedClaimable', function (accounts) {
var delayedClaimable;
beforeEach(function () {
return DelayedClaimable.new().then(function (deployed) {
delayedClaimable = deployed;
});
beforeEach(async function () {
this.delayedClaimable = await DelayedClaimable.new();
});
it('can set claim blocks', async function () {
await delayedClaimable.transferOwnership(accounts[2]);
await delayedClaimable.setLimits(0, 1000);
let end = await delayedClaimable.end();
await this.delayedClaimable.transferOwnership(accounts[2]);
await this.delayedClaimable.setLimits(0, 1000);
const end = await this.delayedClaimable.end();
assert.equal(end, 1000);
let start = await delayedClaimable.start();
const start = await this.delayedClaimable.start();
assert.equal(start, 0);
});
it('changes pendingOwner after transfer successful', async function () {
await delayedClaimable.transferOwnership(accounts[2]);
await delayedClaimable.setLimits(0, 1000);
let end = await delayedClaimable.end();
await this.delayedClaimable.transferOwnership(accounts[2]);
await this.delayedClaimable.setLimits(0, 1000);
const end = await this.delayedClaimable.end();
assert.equal(end, 1000);
let start = await delayedClaimable.start();
const start = await this.delayedClaimable.start();
assert.equal(start, 0);
let pendingOwner = await delayedClaimable.pendingOwner();
const pendingOwner = await this.delayedClaimable.pendingOwner();
assert.equal(pendingOwner, accounts[2]);
await delayedClaimable.claimOwnership({ from: accounts[2] });
let owner = await delayedClaimable.owner();
await this.delayedClaimable.claimOwnership({ from: accounts[2] });
const owner = await this.delayedClaimable.owner();
assert.equal(owner, accounts[2]);
});
it('changes pendingOwner after transfer fails', async function () {
await delayedClaimable.transferOwnership(accounts[1]);
await delayedClaimable.setLimits(100, 110);
let end = await delayedClaimable.end();
await this.delayedClaimable.transferOwnership(accounts[1]);
await this.delayedClaimable.setLimits(100, 110);
const end = await this.delayedClaimable.end();
assert.equal(end, 110);
let start = await delayedClaimable.start();
const start = await this.delayedClaimable.start();
assert.equal(start, 100);
let pendingOwner = await delayedClaimable.pendingOwner();
const pendingOwner = await this.delayedClaimable.pendingOwner();
assert.equal(pendingOwner, accounts[1]);
await assertRevert(delayedClaimable.claimOwnership({ from: accounts[1] }));
let owner = await delayedClaimable.owner();
await assertRevert(this.delayedClaimable.claimOwnership({ from: accounts[1] }));
const owner = await this.delayedClaimable.owner();
assert.isTrue(owner !== accounts[1]);
});
it('set end and start invalid values fail', async function () {
await delayedClaimable.transferOwnership(accounts[1]);
await assertRevert(delayedClaimable.setLimits(1001, 1000));
await this.delayedClaimable.transferOwnership(accounts[1]);
await assertRevert(this.delayedClaimable.setLimits(1001, 1000));
});
});