Reputation: 1
This is my test code " function testingWithDrawWithMultipleFunder() public { //arrange
uint160 numberOfFunders = 10;
uint160 startingFunderIndex = 1;
for (uint160 i = startingFunderIndex; i < numberOfFunders; i++) {
//vm.prank new address
//vm. deal fund new ddress
hoax(address(i), 10 ether);
fundMe.fund{value: 10 ether}();
}
uint256 startingOwnerBalance = fundMe.getOwner().balance;
uint256 startingFundMeBalance = address(fundMe).balance;
console.log(startingOwnerBalance);
console.log(startingFundMeBalance);
//act
vm.startPrank(fundMe.getOwner());
//vm.prank(fundMe.getOwner());
fundMe.withdraw();
//vm.stopPrank();
//Assert
assertEq(address(fundMe).balance, 0);
assertEq(
startingFundMeBalance + startingOwnerBalance,
fundMe.getOwner().balance
);
}"
root@DESKTOP-IM9H78N:~/foundry-fund-me-f23# forge test --match-test testingWithDrawWithMultipleFunder [⠒] Compiling... No files changed, compilation skipped
Ran 1 test for test/FundMeTest.t.sol:FundMeTest [FAIL. Reason: EvmError: Revert] testingWithDrawWithMultipleFunder() (gas: 20480) Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 60.64ms (1.93ms CPU time)
Ran 1 test suite in 81.02ms (60.64ms CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests)
Failing tests: Encountered 1 failing test in test/FundMeTest.t.sol:FundMeTest [FAIL. Reason: EvmError: Revert] testingWithDrawWithMultipleFunder() (gas: 20480)
Encountered a total of 1 failing tests, 0 tests succeeded
Upvotes: 0
Views: 23