-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All tests now use account names, and dont use accounts[0] (except ERC…
…721)
- Loading branch information
Showing
38 changed files
with
191 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
const DestructibleMock = artifacts.require('DestructibleMock'); | ||
const { ethGetBalance } = require('../helpers/web3'); | ||
|
||
contract('Destructible', function (accounts) { | ||
contract('Destructible', function ([_, owner, recipient]) { | ||
beforeEach(async function () { | ||
this.destructible = await DestructibleMock.new({ from: accounts[0] }); | ||
this.destructible = await DestructibleMock.new({ from: owner }); | ||
await web3.eth.sendTransaction({ | ||
from: accounts[0], | ||
from: owner, | ||
to: this.destructible.address, | ||
value: web3.toWei('10', 'ether'), | ||
}); | ||
|
||
this.owner = await this.destructible.owner(); | ||
}); | ||
|
||
it('should send balance to owner after destruction', async function () { | ||
const initBalance = await ethGetBalance(this.owner); | ||
await this.destructible.destroy({ from: this.owner }); | ||
const newBalance = await ethGetBalance(this.owner); | ||
const initBalance = await ethGetBalance(owner); | ||
await this.destructible.destroy({ from: owner }); | ||
const newBalance = await ethGetBalance(owner); | ||
assert.isTrue(newBalance > initBalance); | ||
}); | ||
|
||
it('should send balance to recepient after destruction', async function () { | ||
const initBalance = await ethGetBalance(accounts[1]); | ||
await this.destructible.destroyAndSend(accounts[1], { from: this.owner }); | ||
const newBalance = await ethGetBalance(accounts[1]); | ||
const initBalance = await ethGetBalance(recipient); | ||
await this.destructible.destroyAndSend(recipient, { from: owner }); | ||
const newBalance = await ethGetBalance(recipient); | ||
assert.isTrue(newBalance.greaterThan(initBalance)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.