I'm new to hardhat and solidity. I'm trying to basic example that I found online, however I always get this error at testing.
Here is my hardhat.config.js settings
require("@nomicfoundation/hardhat-toolbox");
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.19",
};
my code is very simple as follows
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;
contract SayHello{
string public sayHi = "SayHello MM";
}
and my test code is as follows
describe ("Testing the Say Hello contract",()=>{
let myContact;
beforeEach(async()=>{
const ContractSayHello = await ethers.getContractFactory("SayHello");
myContact= await ContractSayHello.deploy();
await myContact.deployed();
})
it("get say hi string", async()=>{
expect( await myContact.sayHi()).to.equal("tmam")
})
})
Why am I keep getting the same error? Thanks in advance.
I'm trying to test a code and gives me errors
ReferenceError: expect is not defined
As for this error, did you include import of chai into your test suite?
import { expect } from "chai";