Skip to content

Commit

Permalink
Adding withArgs checks for CustomErrors validations
Browse files Browse the repository at this point in the history
  • Loading branch information
dimpar committed Jan 2, 2024
1 parent c18d23b commit 9e6c630
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
6 changes: 3 additions & 3 deletions core/test/Acre.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,9 +823,9 @@ describe("Acre", () => {
describe("updateDispatcher", () => {
context("when caller is not an owner", () => {
it("should revert", async () => {
await expect(
acre.connect(staker1).updateDispatcher(ZeroAddress),
).to.be.revertedWithCustomError(acre, "OwnableUnauthorizedAccount")
await expect(acre.connect(staker1).updateDispatcher(ZeroAddress))
.to.be.revertedWithCustomError(acre, "OwnableUnauthorizedAccount")
.withArgs(staker1.address)
})
})

Expand Down
24 changes: 15 additions & 9 deletions core/test/Dispatcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ describe("Dispatcher", () => {
it("should revert when adding a vault", async () => {
await expect(
dispatcher.connect(thirdParty).authorizeVault(vaultAddress1),
).to.be.revertedWithCustomError(
dispatcher,
"OwnableUnauthorizedAccount",
)
.to.be.revertedWithCustomError(
dispatcher,
"OwnableUnauthorizedAccount",
)
.withArgs(thirdParty.address)
})
})

Expand Down Expand Up @@ -110,10 +112,12 @@ describe("Dispatcher", () => {
it("should revert when adding a vault", async () => {
await expect(
dispatcher.connect(thirdParty).deauthorizeVault(vaultAddress1),
).to.be.revertedWithCustomError(
dispatcher,
"OwnableUnauthorizedAccount",
)
.to.be.revertedWithCustomError(
dispatcher,
"OwnableUnauthorizedAccount",
)
.withArgs(thirdParty.address)
})
})

Expand Down Expand Up @@ -256,10 +260,12 @@ describe("Dispatcher", () => {
it("should revert", async () => {
await expect(
dispatcher.connect(thirdParty).updateMaintainer(newMaintainer),
).to.be.revertedWithCustomError(
dispatcher,
"OwnableUnauthorizedAccount",
)
.to.be.revertedWithCustomError(
dispatcher,
"OwnableUnauthorizedAccount",
)
.withArgs(thirdParty.address)
})
})

Expand Down

0 comments on commit 9e6c630

Please sign in to comment.