Skip to content

Commit

Permalink
chore: add test for event on set up
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrzn authored and rmeissner committed Sep 1, 2021
1 parent 28ad382 commit 7443889
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
11 changes: 11 additions & 0 deletions test/DaoModuleERC20.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ describe("DaoModuleERC20", async () => {
const Module = await hre.ethers.getContractFactory("DaoModuleERC20")
await Module.deploy(user1.address, user1.address, user1.address, 1, 10, 0, 0, 0)
})

it("should emit event because of successful set up", async () => {
const Module = await hre.ethers.getContractFactory("DaoModuleERC20")
const module = await Module.deploy(
user1.address, user1.address, user1.address, 1, 10, 0, 0, 0
)
await module.deployed()
await expect(module.deployTransaction)
.to.emit(module, "DaoModuleSetup").
withArgs(user1.address, user1.address)
})
})

describe("setQuestionTimeout", async () => {
Expand Down
17 changes: 14 additions & 3 deletions test/DaoModuleETH.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ describe("DaoModuleETH", async () => {
const module = await Module.deploy(user1.address, user1.address, user1.address, 42, 23, 0, 0, 1337)
await expect(
module.setUp(buildMockInitializerParams(mock))
).to.be.revertedWith("Module is already initialized")
})
).to.be.revertedWith("Module is already initialized")
})

it("throws if avatar is zero address", async () => {
const Module = await hre.ethers.getContractFactory("DaoModuleETH")
await expect(
Expand All @@ -96,6 +96,17 @@ describe("DaoModuleETH", async () => {
const Module = await hre.ethers.getContractFactory("DaoModuleETH")
await Module.deploy(user1.address, user1.address, user1.address, 1, 10, 0, 0, 0)
})

it("should emit event because of successful set up", async () => {
const Module = await hre.ethers.getContractFactory("DaoModuleETH")
const module = await Module.deploy(
user1.address, user1.address, user1.address, 1, 10, 0, 0, 0
)
await module.deployed()
await expect(module.deployTransaction)
.to.emit(module, "DaoModuleSetup").
withArgs(user1.address, user1.address)
})
})

describe("setQuestionTimeout", async () => {
Expand Down

0 comments on commit 7443889

Please sign in to comment.