Testing contract with Mocha

I recently run a test using mocha, it is showing 1 failing. What is it that I did wrong

Here is the file:

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

beforeEach(async ()=>{
//Get a list of all accounts
accounts = await web3.eth.getAccounts()
.then(fetchedAccounts =>{
console.log(fetchedAccounts);
});

//Use one of those accounts to deploy
//the contract
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’, ()=> {});

});

1 Like