-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
389 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const moment = require("moment"); | ||
|
||
const Daico = artifacts.require("DaicoTestable"); | ||
const MintableToken = artifacts.require("MintableToken"); | ||
|
||
contract("Daico", (accounts) => { | ||
|
||
const evercityMemberAddress = accounts[0]; | ||
const projectOwnerAddress = accounts[1]; | ||
const inverstorAddress = accounts[2]; | ||
const otherAddress = accounts[3]; | ||
|
||
const minQuorumRate = 70; | ||
const minVoteRate = 70; | ||
const tokenHoldersCount = 5; | ||
|
||
let daico; | ||
let daiToken; | ||
let projectToken; | ||
|
||
beforeEach(async() => { | ||
daiToken = await MintableToken.new(); | ||
projectToken = await MintableToken.new(); | ||
await projectToken.mint(inverstorAddress, 1); | ||
|
||
timestampsFinishAt = [ | ||
moment.unix(web3.eth.getBlock("latest").timestamp).add(1, 'week').unix(), | ||
moment.unix(web3.eth.getBlock("latest").timestamp).add(5, 'weeks').unix() | ||
]; | ||
daico = await Daico.new(daiToken.address, projectToken.address, projectOwnerAddress, 2, [1, 2], timestampsFinishAt, minVoteRate, minQuorumRate, tokenHoldersCount); | ||
}); | ||
|
||
describe("onlyInvestor()", () => { | ||
it("should revert if method is called not by investor", async() => { | ||
await daico.vote(0, true, {from: otherAddress}).should.be.rejectedWith("revert"); | ||
}); | ||
|
||
it("should call method that can be executed only by investor", async() => { | ||
await daico.vote(0, true, {from: inverstorAddress}).should.be.fulfilled; | ||
}); | ||
}); | ||
|
||
describe("validTapIndex()", () => { | ||
it("should revert if tap index does not exist", async() => { | ||
await daico.isTapWithdrawAcceptedByInvestors(2).should.be.rejectedWith("revert"); | ||
}); | ||
|
||
it("should call method with valid tap index", async() => { | ||
await daico.isTapWithdrawAcceptedByInvestors(1).should.be.fulfilled; | ||
}); | ||
}); | ||
|
||
describe("validVotingIndex()", () => { | ||
it("should revert if voting index does not exist", async() => { | ||
await daico.vote(2, true, {from: inverstorAddress}).should.be.rejectedWith("revert"); | ||
}); | ||
|
||
it("should call method with valid tap index", async() => { | ||
await daico.vote(0, true, {from: inverstorAddress}).should.be.fulfilled; | ||
}); | ||
}); | ||
|
||
}); |
Oops, something went wrong.