New answers tagged

0

While writing tests using truffle or for that matter if you are using the mocha library, you have to place the it blocks inside a describe block. contract("Name of a contract", accounts => { describe("What are you testing e.g. a function", () => { it("the function does something", async () => { \\ your assertions go here }); it("the ...


1

please try this: contract("DappToken", function(accounts) { it("Token buying", function() { return DappToken.deployed().then(function (instance) { console.log(instance, 'instance'); }); }); }); This is my example in other smart contract, where the tests are running smoothly: contract("CarData", function(accounts) { /...


0

web3.eth.getBalance returns a Promise, with the actual balance in Wei a a string. To get the balance, you can use Promise.then() or async/await: web3.eth.getBalance(address) .then(balance => { // You can use balance here console.log(balance); }) .catch(console.error); // or const getBalance = async () => { const balance = await web3....


Top 50 recent answers are included