Improve encapsulation on lifecycle, ownership and payments (#1269)
* Improve encapsulation on Pausable * add the underscore * Improve encapsulation on ownership * fix rebase * fix ownership * Improve encapsulation on payments * Add missing tests * add missing test * Do not prefix getters * Fix tests. * revert pending owner reset * add missing underscore * Add missing underscore
This commit is contained in:
committed by
Francisco Giordano
parent
d6c7700f4c
commit
45c0c072d1
@ -28,6 +28,11 @@ contract('RefundEscrow', function ([_, owner, beneficiary, refundee1, refundee2]
|
||||
});
|
||||
|
||||
context('active state', function () {
|
||||
it('has beneficiary and state', async function () {
|
||||
(await this.escrow.beneficiary()).should.be.equal(beneficiary);
|
||||
(await this.escrow.state()).should.be.bignumber.equal(0);
|
||||
});
|
||||
|
||||
it('accepts deposits', async function () {
|
||||
await this.escrow.deposit(refundee1, { from: owner, value: amount });
|
||||
|
||||
|
||||
@ -46,6 +46,17 @@ contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1,
|
||||
this.contract = await SplitPayment.new(this.payees, this.shares);
|
||||
});
|
||||
|
||||
it('should have total shares', async function () {
|
||||
(await this.contract.totalShares()).should.be.bignumber.equal(20 + 10 + 70);
|
||||
});
|
||||
|
||||
it('should have payees', async function () {
|
||||
this.payees.forEach(async (payee, index) => {
|
||||
(await this.payee(index)).should.be.equal(payee);
|
||||
(await this.contract.released(payee)).should.be.bignumber.equal(0);
|
||||
});
|
||||
});
|
||||
|
||||
it('should accept payments', async function () {
|
||||
await ethSendTransaction({ from: owner, to: this.contract.address, value: amount });
|
||||
|
||||
@ -53,11 +64,11 @@ contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1,
|
||||
});
|
||||
|
||||
it('should store shares if address is payee', async function () {
|
||||
(await this.contract.shares.call(payee1)).should.be.bignumber.not.equal(0);
|
||||
(await this.contract.shares(payee1)).should.be.bignumber.not.equal(0);
|
||||
});
|
||||
|
||||
it('should not store shares if address is not payee', async function () {
|
||||
(await this.contract.shares.call(nonpayee1)).should.be.bignumber.equal(0);
|
||||
(await this.contract.shares(nonpayee1)).should.be.bignumber.equal(0);
|
||||
});
|
||||
|
||||
it('should throw if no funds to claim', async function () {
|
||||
@ -96,7 +107,7 @@ contract('SplitPayment', function ([_, owner, payee1, payee2, payee3, nonpayee1,
|
||||
(await ethGetBalance(this.contract.address)).should.be.bignumber.equal(0);
|
||||
|
||||
// check correct funds released accounting
|
||||
(await this.contract.totalReleased.call()).should.be.bignumber.equal(initBalance);
|
||||
(await this.contract.totalReleased()).should.be.bignumber.equal(initBalance);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user