Files
openzeppelin-contracts/test/lifecycle/Destructible.test.js
Nicolás Venturo ac91af9a6a 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
2018-08-10 19:03:04 -03:00

34 lines
1.1 KiB
JavaScript

const DestructibleMock = artifacts.require('DestructibleMock');
const { ethGetBalance } = require('../helpers/web3');
const BigNumber = web3.BigNumber;
require('chai')
.use(require('chai-bignumber')(BigNumber))
.should();
contract('Destructible', function ([_, owner, recipient]) {
beforeEach(async function () {
this.destructible = await DestructibleMock.new({ from: owner });
await web3.eth.sendTransaction({
from: owner,
to: this.destructible.address,
value: web3.toWei('10', 'ether'),
});
});
it('should send balance to owner after destruction', async function () {
const initBalance = await ethGetBalance(owner);
await this.destructible.destroy({ from: owner });
const newBalance = await ethGetBalance(owner);
newBalance.should.be.bignumber.gt(initBalance);
});
it('should send balance to recepient after destruction', async function () {
const initBalance = await ethGetBalance(recipient);
await this.destructible.destroyAndSend(recipient, { from: owner });
const newBalance = await ethGetBalance(recipient);
newBalance.should.be.bignumber.gt(initBalance);
});
});