Increase test coverage to 93% #549 (#768)

* Increase test coverage to 93% #549

* cover missing AllowanceCrowdsale branch

* improve Heritable coverage

* fix lint errors

* proper equal assert

* address review comments

* remove unneeded const definitions and imports

* use assertRevert

* reword scenario description

* Increase test coverage to 93% #549

* cover missing AllowanceCrowdsale branch

* improve Heritable coverage

* fix lint errors

* proper equal assert

* address review comments

* remove unneeded const definitions and imports

* use assertRevert

* reword scenario description

* move HIGH_GOAL constant to the scope where it's used

* remove const at top level

* address review comments
This commit is contained in:
Federico Gimenez
2018-04-17 20:05:34 +02:00
committed by Francisco Giordano
parent 6a7114fdb4
commit f4bdaf49a1
5 changed files with 82 additions and 8 deletions

View File

@ -1,4 +1,5 @@
import ether from '../helpers/ether';
import assertRevert from '../helpers/assertRevert';
const BigNumber = web3.BigNumber;
@ -15,6 +16,7 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
const value = ether(0.42);
const expectedTokenAmount = rate.mul(value);
const tokenAllowance = new BigNumber('1e22');
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
beforeEach(async function () {
this.token = await SimpleToken.new({ from: tokenWallet });
@ -26,7 +28,7 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
it('should accept sends', async function () {
await this.crowdsale.send(value).should.be.fulfilled;
});
it('should accept payments', async function () {
await this.crowdsale.buyTokens(investor, { value: value, from: purchaser }).should.be.fulfilled;
});
@ -65,4 +67,11 @@ contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenW
tokensRemaining.should.be.bignumber.equal(remainingAllowance);
});
});
describe('when token wallet is different from token address', function () {
it('creation reverts', async function () {
this.token = await SimpleToken.new({ from: tokenWallet });
await assertRevert(AllowanceCrowdsale.new(rate, wallet, this.token.address, ZERO_ADDRESS));
});
});
});