Skip to content

Lesson 7: unit testing error for fund #2072

Discussion options

You must be logged in to vote

Try this

describe("fund", async function () { 
            it("Fails if you don't send enough ETH", async function () { 
                      await expect(fundMe.fund()).to.be.revertedWith( "You need to spend 
                      more ETH!" ) 
            })
})

The problem in you code was that you didn't type the exact statement you entered in require statement in fundme.sol the exact statement was You need to spend more ETH! and in test file you are expecting You need to spend more ETH which result in failure of the test.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@narendra-sajwani
Comment options

Answer selected by narendra-sajwani
Comment options

You must be logged in to vote
1 reply
@narendra-sajwani
Comment options

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