Code on the FundMe.test.js #512
-
Why do we need this wait? What does this 1 represent, is it one second? const transactionReceipt = await transactionResponse.wait(1) And on the test "allows us to withdraw with multiple getFunder" await expect(fundMe.getFunder(0)).to.be.reverted |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Beta Was this translation helpful? Give feedback.
const transactionReceipt = await transactionResponse.wait(1)
The 1 here represent that you want to wait for 1 block confirmation....If you pass there 6 you are saying i want to wait for 6 block confirmation.
await expect(fundMe.getFunder(0)).to.be.reverted
In the above line, we are making sure that after the deployer has withdrawn the funds the funders array is reset and it is empty.
Above line has .to.be.reverted here we telling that
fundMe.getFunder(0)
this function will fail(since we have reset the array and there is no element at 0th index) and it will throw error and if it does that means its correct and it should pass the test