Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update tests for RefundableCrowdsale
  • Loading branch information
brunobar79 committed Feb 13, 2018
commit c47a793aca32ca3ce86b65e23975f2bdd6b44eca
23 changes: 21 additions & 2 deletions test/crowdsale/RefundableCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require('chai')

const RefundableCrowdsale = artifacts.require('RefundableCrowdsaleImpl');
const MintableToken = artifacts.require('MintableToken');
const RefundVault = artifacts.require('RefundVault');

contract('RefundableCrowdsale', function ([_, owner, wallet, investor]) {
const rate = new BigNumber(1000);
Expand All @@ -30,15 +31,33 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor]) {
this.afterEndTime = this.endTime + duration.seconds(1);

this.token = await MintableToken.new();
this.vault = await RefundVault.new(wallet);

this.crowdsale = await RefundableCrowdsale.new(
this.startTime, this.endTime, rate, wallet, goal, this.token.address, { from: owner }
this.startTime,
this.endTime,
rate,
wallet,
goal,
this.vault.address,
this.token.address
);

await this.token.transferOwnership(this.crowdsale.address);
await this.vault.transferOwnership(this.crowdsale.address);
});

describe('creating a valid crowdsale', function () {
it('should fail with zero goal', async function () {
await RefundableCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, { from: owner })
await RefundableCrowdsale.new(
this.startTime,
this.endTime,
rate,
wallet,
0,
this.vault.address,
this.token.address
)
.should.be.rejectedWith(EVMRevert);
});
});
Expand Down