Skip to content

Commit

Permalink
add tests for released and releasable
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio committed May 31, 2022
1 parent 15db8cb commit 76240b9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/finance/PaymentSplitter.test.js
Expand Up @@ -62,6 +62,7 @@ contract('PaymentSplitter', function (accounts) {
await Promise.all(this.payees.map(async (payee, index) => {
expect(await this.contract.payee(index)).to.equal(payee);
expect(await this.contract.released(payee)).to.be.bignumber.equal('0');
expect(await this.contract.releasable(payee)).to.be.bignumber.equal('0');
}));
});

Expand Down Expand Up @@ -119,6 +120,26 @@ contract('PaymentSplitter', function (accounts) {
});
});

describe('tracks releasable and released', function () {
it('Ether', async function () {
await send.ether(payer1, this.contract.address, amount);
const payment = amount.divn(10);
expect(await this.contract.releasable(payee2)).to.be.bignumber.equal(payment);
await this.contract.release(payee2);
expect(await this.contract.releasable(payee2)).to.be.bignumber.equal('0');
expect(await this.contract.released(payee2)).to.be.bignumber.equal(payment);
});

it('Token', async function () {
await this.token.transfer(this.contract.address, amount, { from: owner });
const payment = amount.divn(10);
expect(await this.contract.releasable(this.token.address, payee2, {})).to.be.bignumber.equal(payment);
await this.contract.release(this.token.address, payee2);
expect(await this.contract.releasable(this.token.address, payee2, {})).to.be.bignumber.equal('0');
expect(await this.contract.released(this.token.address, payee2)).to.be.bignumber.equal(payment);
});
});

describe('distributes funds to payees', function () {
it('Ether', async function () {
await send.ether(payer1, this.contract.address, amount);
Expand Down

0 comments on commit 76240b9

Please sign in to comment.