Hello guys.
Currently i am testing my Smart Contracts. I want to have a "resetted" state after every test. I heard about the beforeeach hook.

in the beforeeach hook i have a line where i declare: contract.new(), like in the examples.

but with this syntax i cant call my contract methods. i have to use contract.deployed() to call them. any ideas?

Mar 27, 2019, 9:05 PM
let contract;

beforeEach('setup contract for each test', async() => {
contract = await Contract.new({from:accounts[0]});
});

it("- has the right owner", async() => {
assert.equal(await contract.owner(), tronWeb.address.toHex(accounts[0]));
});
Mar 27, 2019, 9:20 PM

© 2024 Draquery.com All rights reserved.