1

I am writing the test by following the lesson 7 tutorial and got this error, even I imported Test from forge-std
Undeclared identifier. Did you mean "assert"?
this is the actual error

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import {Test, console} from "forge-std/Test.sol";
import {FundMe} from "../src/FundMe.sol";

contract FundMeTest {
    FundMe fundme;

    function setup() external {
        fundme = new FundMe();
    }

    function checkMminimumDollar() public {
        assertEq(fundme.MINIMUM_USD(), 5e18);
    }
}

1 Answer 1

4

You need to inherit the test.sol in your test contract.

Like this :

contract FundMeTest is Test {
    FundMe fundme;

    function setup() external {
        fundme = new FundMe();
    }

    function checkMminimumDollar() public {
        assertEq(fundme.MINIMUM_USD(), 5e18);
    }
}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.