Expected transaction to be reverted with reason 'FundMe__NotOwner', but it reverted with a custom error #1483
Answered
by
alymurtazamemon
deeptshukla
asked this question in
Q&A
-
Hey devs, it("Only allows owner to withdraw", async () => {
const accounts = await ethers.getSigners()
const fundMeConnectedContract = await fundMe.connect(accounts[2])
//Doesn't work. Has something changed?
// await expect(fundMeConnectedContract.withdraw()).to.be.revertedWith(
// "FundMe__NotOwner"
// )
// This works, but not sure why the above doesn't, when it is mentioned in the documentation itself.
await expect(
fundMeConnectedContract.withdraw()
).to.be.revertedWithCustomError(
fundMeConnectedContract,
"FundMe__NotOwner"
)
}) As mentioned in the comments, the first assert doesn't work, which is mentioned in the main repo. git clone [email protected]:deeptshukla/hardhat-fund-me.git Let me know, if anything has changed and should I create a pull request to update this. |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Aug 3, 2022
Replies: 1 comment
-
@deeptshukla You are using a newer version of hardhat where chai matachers are updated, repo code is compatible with all old packages. I will update the whole code to newer versions do not worry. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
alymurtazamemon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@deeptshukla You are using a newer version of hardhat where chai matachers are updated, repo code is compatible with all old packages. I will update the whole code to newer versions do not worry.