added a test helper with common constants (#1400)

* signing prefix added

* Minor improvement

* Tests changed

* Successfully tested

* Minor improvements

* Minor improvements

* Revert "Dangling commas are now required. (#1359)"

This reverts commit a6889776f4.

* updates

* fixes #1206
This commit is contained in:
Aniket
2018-10-10 00:16:09 +05:30
committed by Nicolás Venturo
parent af42c39e6c
commit 58a42443df
22 changed files with 36 additions and 36 deletions

View File

@ -1,6 +1,7 @@
const { shouldBehaveLikeEscrow } = require('./Escrow.behavior');
const { expectThrow } = require('../helpers/expectThrow');
const { EVMRevert } = require('../helpers/EVMRevert');
const { ether } = require('../helpers/ether');
const BigNumber = web3.BigNumber;
@ -24,7 +25,7 @@ contract('ConditionalEscrow', function ([_, owner, payee, ...otherAccounts]) {
});
context('when withdrawal is disallowed', function () {
const amount = web3.toWei(23.0, 'ether');
const amount = ether(23.0);
beforeEach(async function () {
await this.escrow.setAllowed(payee, false);

View File

@ -2,6 +2,7 @@ const expectEvent = require('../helpers/expectEvent');
const { expectThrow } = require('../helpers/expectThrow');
const { EVMRevert } = require('../helpers/EVMRevert');
const { ethGetBalance } = require('../helpers/web3');
const { ether } = require('../helpers/ether');
const BigNumber = web3.BigNumber;
@ -10,7 +11,7 @@ require('chai')
.should();
function shouldBehaveLikeEscrow (primary, [payee1, payee2]) {
const amount = web3.toWei(42.0, 'ether');
const amount = ether(42.0);
describe('as an escrow', function () {
describe('deposits', function () {

View File

@ -1,4 +1,5 @@
const { ethGetBalance } = require('../helpers/web3');
const { ether } = require('../helpers/ether');
const BigNumber = web3.BigNumber;
@ -9,7 +10,7 @@ require('chai')
const PullPaymentMock = artifacts.require('PullPaymentMock');
contract('PullPayment', function ([_, payer, payee1, payee2]) {
const amount = web3.toWei(17.0, 'ether');
const amount = ether(17.0);
beforeEach(async function () {
this.contract = await PullPaymentMock.new({ value: amount });

View File

@ -2,6 +2,8 @@ const { expectThrow } = require('../helpers/expectThrow');
const { EVMRevert } = require('../helpers/EVMRevert');
const expectEvent = require('../helpers/expectEvent');
const { ethGetBalance } = require('../helpers/web3');
const { ether } = require('../helpers/ether');
const { ZERO_ADDRESS } = require('../helpers/constants');
const BigNumber = web3.BigNumber;
@ -12,9 +14,8 @@ require('chai')
const RefundEscrow = artifacts.require('RefundEscrow');
contract('RefundEscrow', function ([_, primary, beneficiary, refundee1, refundee2]) {
const amount = web3.toWei(54.0, 'ether');
const amount = ether(54.0);
const refundees = [refundee1, refundee2];
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
it('requires a non-null beneficiary', async function () {
await expectThrow(

View File

@ -1,5 +1,7 @@
const { ethGetBalance } = require('../helpers/web3');
const { sendEther } = require('./../helpers/sendTransaction');
const { ether } = require('../helpers/ether');
const { ZERO_ADDRESS } = require('./../helpers/constants');
const BigNumber = web3.BigNumber;
@ -12,8 +14,7 @@ const { EVMRevert } = require('../helpers/EVMRevert.js');
const SplitPayment = artifacts.require('SplitPayment');
contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1, payer1]) {
const amount = web3.toWei(1.0, 'ether');
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
const amount = ether(1.0);
it('rejects an empty set of payees', async function () {
await expectThrow(SplitPayment.new([], []), EVMRevert);