Skip to content

lesson- 7 testing AssertionError: Expected transaction to be reverted with reason #1885

Answered by TimeKeyRoll
TimeKeyRoll asked this question in Q&A
Discussion options

You must be logged in to vote

I have figured it. Since we aint using hardhat-waffle but chai-matchers so things have been changed with this.

That's how i fixed it.

await expect(
                attackerConnectedContract.withdrawal()
                //line by course
                // ).to.be.revertedWith("FundMe_NotOwner")
                //line changed since we using chai matchers not harahdt-waffle
            ).to.be.revertedWithCustomError(fundme, "FundMe_NotOwner")
        })

Replies: 2 comments 25 replies

Comment options

You must be logged in to vote
21 replies
@TimeKeyRoll
Comment options

@Sairam002
Comment options

@TimeKeyRoll
Comment options

@Sairam002
Comment options

@TimeKeyRoll
Comment options

Comment options

You must be logged in to vote
4 replies
@Sairam002
Comment options

@TimeKeyRoll
Comment options

@isub897
Comment options

@TimeKeyRoll
Comment options

Answer selected by TimeKeyRoll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants