I'm running a test using hardhat and chai. I keep getting this error:
Error: Timeout of 40000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/mnt/c/Users/hp/Documents/SolidityProj/general/test/faucetTest.js)
This is the test code:
const { loadFixture } = require("@nomicfoundation/hardhat-network-helpers");
const { expect } = require("chai");
describe("Faucet", function () {
async function deployContractAndSetVariables() {
const Faucet = await ethers.getContractFactory("Faucet");
const faucet = await Faucet.deploy();
const [owner] = await ethers.getSigners();
console.log("Signer 1 address: ", owner.address);
return { faucet, owner };
}
it("should deploy and set the owner correctly", async function () {
const { faucet, owner } = await loadFixture(deployContractAndSetVariables);
expect(await faucet.owner()).to.equal(owner.address);
});
});
This is my hardhat.config file:
require("@nomicfoundation/hardhat-toolbox");
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.17",
};