Skip to content

Commit

Permalink
test: init when voteTime <= objectionTime
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDZhon authored and folkyatina committed Jun 28, 2022
1 parent 54c9df3 commit 7ad63e0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/voting/test/helpers/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ module.exports = makeErrorMappingProxy({
VOTING_NO_VOTING_POWER: 'VOTING_NO_VOTING_POWER',
VOTING_OBJ_TIME_TOO_BIG: 'VOTING_OBJ_TIME_TOO_BIG',
VOTING_VOTE_TIME_TOO_SMALL: 'VOTING_VOTE_TIME_TOO_SMALL',
VOTING_INIT_OBJ_TIME_TOO_BIG: 'VOTING_INIT_OBJ_TIME_TOO_BIG'
})
27 changes: 27 additions & 0 deletions apps/voting/test/voting.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,33 @@ contract('Voting App', ([root, holder1, holder2, holder20, holder29, holder51, n
token = await MiniMeToken.new(ZERO_ADDRESS, ZERO_ADDRESS, 0, 'n', 0, 'n', true) // empty parameters minime
})

it('fails if voteTime less or equal to objectionTime', async () => {
let badVoteTime = objectionPhase
const neededSupport = pct16(50)
const minimumAcceptanceQuorum = pct16(20)

await assertRevert(
voting.initialize(
token.address,
neededSupport,
minimumAcceptanceQuorum,
badVoteTime,
objectionPhase
), ERRORS.VOTING_INIT_OBJ_TIME_TOO_BIG
)

badVoteTime = objectionPhase / 2
await assertRevert(
voting.initialize(
token.address,
neededSupport,
minimumAcceptanceQuorum,
badVoteTime,
objectionPhase
), ERRORS.VOTING_INIT_OBJ_TIME_TOO_BIG
)
})

it('fails if min acceptance quorum is greater than min support', async () => {
const neededSupport = pct16(20)
const minimumAcceptanceQuorum = pct16(50)
Expand Down

0 comments on commit 7ad63e0

Please sign in to comment.