const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const inbox = require('../compile');
const web3 = new Web3(ganache.provider());
const interface = inbox.interface;
const bytecode = inbox.bytecode;
let contractAddress,inboxContract;
beforeEach(()=>{
// Get a list of all accounts
return web3.eth.getAccounts()
.then(accountList=>{
contractAddress = Array.from(accountList)[0];
return contractAddress;
})
.then(contractAddress=>{
inboxContract = new web3.eth.Contract(JSON.parse(interface))
.deploy({data: bytecode, arguments:['Hi there!']})
.send({from: contractAddress, gas: '1000000'});
return inboxContract;
})
//Use one of the accounts to deploy the contract
});
describe('Inbox contract test',()=>{
it('Successfully Deploy Test',()=>{
assert.ok(inboxContract.options.address);
})
it('Default Value test',()=>{
})
it('setMessage Test',()=>{
})
})
output- I want beforeEach to execute completely before running it() block. Am I missing something here in Promise. Ideally beforeEach() should complete before executing the test cases.