2025-01-24 09:22:21 +01:00
|
|
|
const { expect } = require("chai")
|
2025-04-09 16:08:13 +02:00
|
|
|
const PeriodsModule = require("../ignition/modules/periods")
|
2025-01-24 09:22:21 +01:00
|
|
|
|
|
|
|
|
describe("Periods", function () {
|
|
|
|
|
it("should revert when secondsPerPeriod is 0", async function () {
|
2025-04-09 16:08:13 +02:00
|
|
|
const promise = ignition.deploy(PeriodsModule, {
|
|
|
|
|
parameters: {
|
|
|
|
|
Periods: {
|
|
|
|
|
secondsPerPeriod: 0,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
const expectedError = "Periods_InvalidSecondsPerPeriod"
|
|
|
|
|
|
|
|
|
|
const error = await expect(promise).to.be.rejected
|
|
|
|
|
expect(error)
|
|
|
|
|
.to.have.property("message")
|
|
|
|
|
.that.contains(
|
|
|
|
|
expectedError,
|
2025-04-09 16:20:26 +02:00
|
|
|
`Expected error ${expectedError}, but got ${error.message}`,
|
2025-04-09 16:08:13 +02:00
|
|
|
)
|
2025-01-24 09:22:21 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it("should not revert when secondsPerPeriod more than 0", async function () {
|
2025-04-09 16:08:13 +02:00
|
|
|
const promise = ignition.deploy(PeriodsModule, {
|
|
|
|
|
parameters: {
|
|
|
|
|
Periods: {
|
|
|
|
|
secondsPerPeriod: 10,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
await expect(promise).not.to.be.rejected
|
2025-01-24 09:22:21 +01:00
|
|
|
})
|
|
|
|
|
})
|