0
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
    inbox = await new web3.eth.Contract(JSON.parse(interface))
        .deploy({ date: bytecode, arguments:['hi there!']})
        .send({ from: accounts[0], gas:'1000000' });
});
describe('Inbox', () => {
    it('deploys a contract', () => {
        console.log(inbox);
    });
});

failing: "before each" hook for "deploys a contract": TypeError: Cannot read property 'send' of null at Context.beforeEach (test/Inbox.test.js:20:9) at processTicksAndRejections (internal/process/next_tick.js:81:5)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.