Skip to content

Lesson 14: testing randomIpfs.test.ts, revertedWith is not working as expected. #1075

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

You must be logged in to vote

@ali-thegilfoyle @krakxn @PatrickAlphaC

So I saw another supported method revertedWithCustomError and its working.

it("Reverts if send ETH is less", async () => {
    const lessmintFee = ethers.utils.parseEther("0.001");

    await expect(
        randomIpfsNft.requestNft({
            value: lessmintFee.toString(),
        })
    ).to.be.revertedWithCustomError(
        randomIpfsNft,
        "NeedMoreETHSent"
    );
});

I wonder why the revertedWith is not working? Due to changes in chai ? Not sure.

Replies: 2 comments 19 replies

Comment options

You must be logged in to vote
5 replies
@sanjayojha
Comment options

@krakxn
Comment options

@sanjayojha
Comment options

@krakxn
Comment options

@alymurtazamemon
Comment options

Comment options

You must be logged in to vote
14 replies
@alymurtazamemon
Comment options

@sanjayojha
Comment options

@alymurtazamemon
Comment options

@alymurtazamemon
Comment options

@sanjayojha
Comment options

Answer selected by sanjayojha
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