Lesson:7 || Only owner test reverts with custom error not "FundMe__NotOwner" || #5715
Answered
by
alymurtazamemon
MohammadRokib
asked this question in
Q&A
-
I wrote the test for it("Only allows the owner to withdraw", async function () {
const accounts = await ethers.getSigners();
const accountConnect = await fundMe.connect(accounts[1]);
await expect(
accountConnect.withdraw()
).to.be.revertedWith("FundMe__NotOwner")
}); But it give the following error: Here is the github repo |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Jun 19, 2023
Replies: 1 comment
-
@MohammadRokib Use this; await expect(
accountConnect.withdraw()
).to.be.revertedWithCustomError(fundMe, "FundMe__NotOwner"); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
MohammadRokib
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@MohammadRokib Use this;