I was having the same issues as the rest of the forum with running test but it not working so I had to downgrade node.js.
When i use test, it runs now but it always gives me “0 passing”.
I’m not sure if this is problem with node or my code? I also saw there is a new Smart Contract 201 class. Should I just do that if this old version has compatibility issues?
Here is my code:
HelloWorld.js
pragma solidity 0.5.12;
contract HelloWorld {
string message = "Hello World!";
function getMessage() public view returns (string memory) {
return message;
}
function setMessage(string memory _message) public payable {
message = _message;
}
}
2_HelloWorld_deploy.js
const HelloWorld = artifacts.require("HelloWorld");
module.exports = function(deployer, network, accounts){
deployer.deploy(HelloWorld).then(function(instance){
instance.setMessage("PROMISE", {value: 100000000000000000, from: accounts[0]}).then(function(){
console.log("SET SUCCESS");
}).catch(function(err){
console.log("ERROR: " + err);
});
}).catch(function(err){
console.log("Deloy failed: " + err);
});
};
HelloWorldTest.js
const HelloWorld = artifacts.require("HelloWorld");
contract("HelloWorld", async function(){
it("should initialize correctly", async function(){
let instance = await HelloWorld.deployed();
let message = await instance.getMessage();
assert(message == "PROMISE");
});
});
Thanks for the help!