0

My code:

const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());
const { interface,bytecode} = require('../compile');

let accounts;
let inbox;

beforeEach( async() => {
accounts = await web3.eth.getAccounts();
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 a contract', () => {
    console.log(inbox);
 })
})

The error while running it using npm run test:

`shreyas@shreyas-Inspiron-3520:~/inbox$ npm run test

inbox@1.0.0-beta.55 test /home/shreyas/inbox mocha

inbox 1) "before each" hook for "deploys a contract"

0 passing (2s) 1 failing

  1. "before each" hook for "deploys a contract": Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7)

Git Repository of my project: https://github.com/shreyasjain/inbox

TylerH
  • 20,799
  • 66
  • 75
  • 101

0 Answers0