From 9e6c63009d1413d72c77fd7c7b8c7011fa73e488 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 2 Jan 2024 15:10:07 +0100 Subject: [PATCH] Adding withArgs checks for CustomErrors validations --- core/test/Acre.test.ts | 6 +++--- core/test/Dispatcher.test.ts | 24 +++++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/core/test/Acre.test.ts b/core/test/Acre.test.ts index 29f9b2292..3e9d8a0c7 100644 --- a/core/test/Acre.test.ts +++ b/core/test/Acre.test.ts @@ -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) }) }) diff --git a/core/test/Dispatcher.test.ts b/core/test/Dispatcher.test.ts index f4dde05a7..99d3247cb 100644 --- a/core/test/Dispatcher.test.ts +++ b/core/test/Dispatcher.test.ts @@ -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) }) }) @@ -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) }) }) @@ -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) }) })