I was learning about testing smart contract using mocha but stuck on this part
I have tried to resolve it by putting done() function but error persisted. also tried to increase timeout to 10000ms but same error occurred after 10sec.
let accounts;
let inbox;
beforeEach(async () => {
// Get a list of all accounts
accounts = await web3.eth.getAccounts();
//Use one of those accounts to deploy the Contract
// Assign deployed contract and assigning to inbox
inbox = await new web3.eth.Contract(JSON.parse(interface))
.deploy({ data: bytecode, arguments: ['Hi there!'] })
.send({ from: accounts[0], gas: '1000000' });
});
describe('Inbox', () => {
it('deploys contract', () =>{
console.log(inbox);
});
});
Error Message:
Inbox:
- "before each" hook for "deploys contract"
0 passing (2s)
1 failing
"before each" hook for "deploys contract":
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.