All tests now use account names, and dont use accounts[0] (except ERC… (#1137)

* All tests now use account names, and dont use accounts[0] (except ERC721)

* Added account names to some missing contracts.
This commit is contained in:
Nicolás Venturo
2018-08-02 16:55:31 -03:00
committed by GitHub
parent f49721576f
commit 4544df47da
41 changed files with 210 additions and 300 deletions

View File

@ -10,24 +10,21 @@ require('chai')
const ConditionalEscrowMock = artifacts.require('ConditionalEscrowMock');
contract('ConditionalEscrow', function (accounts) {
const owner = accounts[0];
contract('ConditionalEscrow', function ([_, owner, payee, ...otherAccounts]) {
beforeEach(async function () {
this.escrow = await ConditionalEscrowMock.new({ from: owner });
});
context('when withdrawal is allowed', function () {
beforeEach(async function () {
await Promise.all(accounts.map(payee => this.escrow.setAllowed(payee, true)));
await Promise.all(otherAccounts.map(payee => this.escrow.setAllowed(payee, true)));
});
shouldBehaveLikeEscrow(owner, accounts.slice(1));
shouldBehaveLikeEscrow(owner, otherAccounts);
});
context('when withdrawal is disallowed', function () {
const amount = web3.toWei(23.0, 'ether');
const payee = accounts[1];
beforeEach(async function () {
await this.escrow.setAllowed(payee, false);