Updated sendTransaction, added tests. (#1528)

* Renamed sendTransaction to send, improved API.

* Added send tests.

* Now using promisified web3
This commit is contained in:
Nicolás Venturo
2018-12-01 02:47:32 -03:00
committed by GitHub
parent 88e8c7c94b
commit c0bda4db88
7 changed files with 107 additions and 22 deletions

View File

@ -1,6 +1,6 @@
const { ethGetBalance } = require('../helpers/web3');
const expectEvent = require('../helpers/expectEvent');
const { sendEther } = require('./../helpers/sendTransaction');
const send = require('./../helpers/send');
const { ether } = require('../helpers/ether');
const { ZERO_ADDRESS } = require('./../helpers/constants');
@ -60,7 +60,7 @@ contract('PaymentSplitter', function ([_, owner, payee1, payee2, payee3, nonpaye
});
it('should accept payments', async function () {
await sendEther(owner, this.contract.address, amount);
await send.ether(owner, this.contract.address, amount);
(await ethGetBalance(this.contract.address)).should.be.bignumber.equal(amount);
});
@ -78,12 +78,12 @@ contract('PaymentSplitter', function ([_, owner, payee1, payee2, payee3, nonpaye
});
it('should throw if non-payee want to claim', async function () {
await sendEther(payer1, this.contract.address, amount);
await send.ether(payer1, this.contract.address, amount);
await shouldFail.reverting(this.contract.release(nonpayee1));
});
it('should distribute funds to payees', async function () {
await sendEther(payer1, this.contract.address, amount);
await send.ether(payer1, this.contract.address, amount);
// receive funds
const initBalance = await ethGetBalance(this.contract.address);