Skip to content

Commit

Permalink
tests: fix draft, subscriptions, and appeal tests
Browse files Browse the repository at this point in the history
  • Loading branch information
facuspagnuolo committed Oct 25, 2019
1 parent 207bf66 commit 171c771
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions test/court/court-draft.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ contract('Court', ([_, disputer, drafter, juror500, juror1000, juror1500, juror2
let lastTerm
for (let batch = 0; batch < batches; batch++) {
await court.draft(disputeId, { from: drafter })
lastTerm = await court.getLastEnsuredTermId()
lastTerm = await courtHelper.controller.getLastEnsuredTermId()

// advance one term to avoid drafting all the batches in the same term
if (batch + 1 < batches) await courtHelper.passRealTerms(1)
Expand Down Expand Up @@ -262,7 +262,7 @@ contract('Court', ([_, disputer, drafter, juror500, juror1000, juror1500, juror2
const maxJurorsPerDraftBatch = firstRoundJurorsNumber

beforeEach('set max number of jurors to be drafted per batch', async () => {
await court.setMaxJurorsPerDraftBatch(maxJurorsPerDraftBatch)
await court.setMaxJurorsPerDraftBatch(maxJurorsPerDraftBatch, { from: configGovernor })
})

itDraftsRequestedRoundInOneBatch(term, maxJurorsPerDraftBatch)
Expand All @@ -272,7 +272,7 @@ contract('Court', ([_, disputer, drafter, juror500, juror1000, juror1500, juror2
const batches = 2, maxJurorsPerDraftBatch = 4

beforeEach('set max number of jurors to be drafted per batch', async () => {
await court.setMaxJurorsPerDraftBatch(maxJurorsPerDraftBatch)
await court.setMaxJurorsPerDraftBatch(maxJurorsPerDraftBatch, { from: configGovernor })
})

itDraftsRequestedRoundInMultipleBatches(term, firstRoundJurorsNumber, batches, maxJurorsPerDraftBatch)
Expand All @@ -283,7 +283,7 @@ contract('Court', ([_, disputer, drafter, juror500, juror1000, juror1500, juror2
const maxJurorsPerDraftBatch = Math.floor(firstRoundJurorsNumber / 2)

beforeEach('set max number of jurors to be drafted per batch', async () => {
await court.setMaxJurorsPerDraftBatch(maxJurorsPerDraftBatch)
await court.setMaxJurorsPerDraftBatch(maxJurorsPerDraftBatch, { from: configGovernor })
})

itDraftsRequestedRoundInOneBatch(term, maxJurorsPerDraftBatch)
Expand All @@ -293,7 +293,7 @@ contract('Court', ([_, disputer, drafter, juror500, juror1000, juror1500, juror2
const maxJurorsPerDraftBatch = firstRoundJurorsNumber * 2

beforeEach('set max number of jurors to be drafted per batch', async () => {
await court.setMaxJurorsPerDraftBatch(maxJurorsPerDraftBatch)
await court.setMaxJurorsPerDraftBatch(maxJurorsPerDraftBatch, { from: configGovernor })
})

itDraftsRequestedRoundInOneBatch(term, maxJurorsPerDraftBatch)
Expand Down Expand Up @@ -336,8 +336,8 @@ contract('Court', ([_, disputer, drafter, juror500, juror1000, juror1500, juror2

context('when the current term is after the randomness block number by 256 blocks', () => {
beforeEach('move 256 blocks after the draft term block number', async () => {
// moving 255 blocks instead of 256 since the `beforeEach` block will hit the next block
await advanceBlocksAfterDraftBlockNumber(255)
// moving 254 blocks instead of 256 since the `beforeEach` block will hit two more blocks
await advanceBlocksAfterDraftBlockNumber(254)
})

itHandlesDraftsProperlyForDifferentRequestedJurorsNumber(term)
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ module.exports = (web3, artifacts) => {
firstRoundJurorsNumber: bn(3), // disputes start with 3 jurors
appealStepFactor: bn(3), // each time a new appeal occurs, the amount of jurors to be drafted will be incremented 3 times
maxRegularAppealRounds: bn(2), // there can be up to 2 appeals in total per dispute
appealCollateralFactor: bn(2), // multiple of juror fees required to appeal a preliminary ruling
appealConfirmCollateralFactor: bn(3), // multiple of juror fees required to confirm appeal
appealCollateralFactor: bn(25000), // permyriad multiple of juror fees required to appeal a preliminary ruling (1/10,000)
appealConfirmCollateralFactor: bn(35000), // permyriad multiple of juror fees required to confirm appeal (1/10,000)
jurorsMinActiveBalance: bigExp(100, 18), // 100 ANJ is the minimum balance jurors must activate to participate in the Court
finalRoundWeightPrecision: bn(1000), // use to improve division rounding for final round maths
subscriptionPeriodDuration: bn(10), // each subscription period lasts 10 terms
Expand Down
2 changes: 1 addition & 1 deletion test/subscriptions/subscriptions-payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contract('CourtSubscriptions', ([_, governor, payer, subscriber, anotherSubscrib

context('when the court has not started yet', () => {
it('reverts', async () => {
await assertRevert(subscriptions.payFees(subscriber, periods), 'MATH_SUB_UNDERFLOW')
await assertRevert(subscriptions.payFees(subscriber, periods), 'CS_COURT_HAS_NOT_STARTED')
})
})

Expand Down

0 comments on commit 171c771

Please sign in to comment.