[英]Error: VM Exception while processing transaction: reverted with reason string 'You need to spend more ETH!'
At the unit testing section on solidity course Lesson7 around 11:23 solidity课程Lesson7单元测试部分 11:23左右
https://youtu.be/gyMwXuJrbJQ?t=41004。 Failed the test "updated the amount funded data structure". https://youtu.be/gyMwXuJrbJQ?t=41004。未通过“更新金额数据结构”测试。 Seems like sendValue failed but I declared the sendValue for 1 Ether and pass the args of sendvalue.
似乎 sendValue 失败了,但我声明了 1 Ether 的 sendValue 并传递了 sendvalue 的参数。
Error Information错误信息
FundMe
fund
updated the amount funded data structure:
Error: VM Exception while processing transaction: reverted with reason string 'You need to spend more ETH!'
at FundMe.fund (contracts/FundMe.sol:40)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
test script - fundme.test.js测试脚本 - fundme.test.js
const sendValue = ethers.utils.parseEther("1")
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!"
)
})
it("updated the amount funded data structure", async function () {
// 执行fund,获取funder的地址=>金额映射,和fund的金额做对比
await fundMe.fund({ value: sendValue })
const response = await fundMe.addressToAmountFunded(deployer)
assert.equal(response.toString(), sendValue.toString())
})
try to remove the "async" word from:尝试从以下位置删除“异步”字样:
describe("fund", async function () {
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.