Replace all asserts with chai.should (#1183)

* Moving towards chai.should.

* Fixed failing tests.

* Fixed linter errors.

* Revert package-lock.json changes.

* Fixed failing tests.

* s/eq/equal

* Addressed review comment
This commit is contained in:
Nicolás Venturo
2018-08-10 19:03:04 -03:00
committed by Francisco Giordano
parent a2e7103869
commit ac91af9a6a
41 changed files with 396 additions and 297 deletions

View File

@ -3,6 +3,12 @@ const { ethGetBalance } = require('../helpers/web3');
const TokenDestructible = artifacts.require('TokenDestructible');
const StandardTokenMock = artifacts.require('StandardTokenMock');
const BigNumber = web3.BigNumber;
require('chai')
.use(require('chai-bignumber')(BigNumber))
.should();
contract('TokenDestructible', function ([_, owner]) {
let tokenDestructible;
@ -18,20 +24,20 @@ contract('TokenDestructible', function ([_, owner]) {
await tokenDestructible.destroy([], { from: owner });
const newBalance = await ethGetBalance(owner);
assert.isTrue(newBalance > initBalance);
newBalance.should.be.bignumber.gt(initBalance);
});
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);
assert.equal(initContractBalance, 100);
assert.equal(initOwnerBalance, 0);
initContractBalance.should.be.bignumber.equal(100);
initOwnerBalance.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);
assert.equal(newContractBalance, 0);
assert.equal(newOwnerBalance, 100);
newContractBalance.should.be.bignumber.equal(0);
newOwnerBalance.should.be.bignumber.equal(100);
});
});