sanity check for CappedCrowdsale: cap > 0

pull/317/head
Jakub Wojciechowski 8 years ago committed by Francisco Giordano
parent 6035bd522b
commit db40fd314a
  1. 1
      contracts/crowdsale/CappedCrowdsale.sol
  2. 9
      test/CappedCrowdsale.js

@ -13,6 +13,7 @@ contract CappedCrowdsale is Crowdsale {
uint256 public cap; uint256 public cap;
function CappedCrowdsale(uint256 _cap) { function CappedCrowdsale(uint256 _cap) {
require(_cap > 0);
cap = _cap; cap = _cap;
} }

@ -19,6 +19,15 @@ contract('CappedCrowdsale', function ([_, wallet]) {
const cap = ether(300) const cap = ether(300)
const lessThanCap = ether(60) const lessThanCap = ether(60)
describe('creating a valid crowdsale', function () {
it('should fail with zero cap', async function () {
await CappedCrowdsale.new(this.startBlock, this.endBlock, rate, wallet, 0).should.be.rejectedWith(EVMThrow);
})
});
beforeEach(async function () { beforeEach(async function () {
this.startBlock = web3.eth.blockNumber + 10 this.startBlock = web3.eth.blockNumber + 10
this.endBlock = web3.eth.blockNumber + 20 this.endBlock = web3.eth.blockNumber + 20

Loading…
Cancel
Save