Improve encapsulation on Crowdsales (#1268)

* Improve encapsulation on Crowdsales

* add missing tests

* remove only

* Do not prefix getters
This commit is contained in:
Leo Arias
2018-09-05 15:34:21 -06:00
committed by Francisco Giordano
parent 7bb87237f3
commit b8a70f0e55
12 changed files with 141 additions and 50 deletions

View File

@ -25,6 +25,10 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
});
describe('accepting payments', function () {
it('should have token wallet', async function () {
(await this.crowdsale.tokenWallet()).should.be.equal(tokenWallet);
});
it('should accept sends', async function () {
await this.crowdsale.send(value);
});

View File

@ -55,6 +55,11 @@ contract('IncreasingPriceCrowdsale', function ([_, investor, wallet, purchaser])
await this.token.transfer(this.crowdsale.address, tokenSupply);
});
it('should have initial and final rate', async function () {
(await this.crowdsale.initialRate()).should.be.bignumber.equal(initialRate);
(await this.crowdsale.finalRate()).should.be.bignumber.equal(finalRate);
});
it('at start', async function () {
await increaseTimeTo(this.startTime);
await this.crowdsale.buyTokens(investor, { value, from: purchaser });

View File

@ -47,6 +47,7 @@ contract('PostDeliveryCrowdsale', function ([_, investor, wallet, purchaser]) {
});
it('does not immediately assign tokens to beneficiaries', async function () {
(await this.crowdsale.balanceOf(investor)).should.be.bignumber.equal(value);
(await this.token.balanceOf(investor)).should.be.bignumber.equal(0);
});
@ -61,6 +62,7 @@ contract('PostDeliveryCrowdsale', function ([_, investor, wallet, purchaser]) {
it('allows beneficiaries to withdraw tokens', async function () {
await this.crowdsale.withdrawTokens(investor);
(await this.crowdsale.balanceOf(investor)).should.be.bignumber.equal(0);
(await this.token.balanceOf(investor)).should.be.bignumber.equal(value);
});