Changed before for beforeAll, refactored Bouncer tests. (#1094)
* Changed before for beforeAll, refactored Bouncer tests. * Fixed linter errors. * fix: updates for SignatureBouncer tests and voucher construction
This commit is contained in:
@ -2,20 +2,21 @@ var Destructible = artifacts.require('Destructible');
|
||||
const { ethGetBalance } = require('../helpers/web3');
|
||||
|
||||
contract('Destructible', function (accounts) {
|
||||
beforeEach(async function () {
|
||||
this.destructible = await Destructible.new({ from: accounts[0], value: web3.toWei('10', 'ether') });
|
||||
this.owner = await this.destructible.owner();
|
||||
});
|
||||
|
||||
it('should send balance to owner after destruction', async function () {
|
||||
let destructible = await Destructible.new({ from: accounts[0], value: web3.toWei('10', 'ether') });
|
||||
let owner = await destructible.owner();
|
||||
let initBalance = await ethGetBalance(owner);
|
||||
await destructible.destroy({ from: owner });
|
||||
let newBalance = await ethGetBalance(owner);
|
||||
let initBalance = await ethGetBalance(this.owner);
|
||||
await this.destructible.destroy({ from: this.owner });
|
||||
let newBalance = await ethGetBalance(this.owner);
|
||||
assert.isTrue(newBalance > initBalance);
|
||||
});
|
||||
|
||||
it('should send balance to recepient after destruction', async function () {
|
||||
let destructible = await Destructible.new({ from: accounts[0], value: web3.toWei('10', 'ether') });
|
||||
let owner = await destructible.owner();
|
||||
let initBalance = await ethGetBalance(accounts[1]);
|
||||
await destructible.destroyAndSend(accounts[1], { from: owner });
|
||||
await this.destructible.destroyAndSend(accounts[1], { from: this.owner });
|
||||
let newBalance = await ethGetBalance(accounts[1]);
|
||||
assert.isTrue(newBalance.greaterThan(initBalance));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user