I have a .sol contract:
contract HelloWorld {
string name="TEST";
uint number;
function HelloWorld() {
}
function getName() returns (string) {
return name;
}
function getNumber() returns (uint) {
return number;
}
function setNumber(uint _number) {
number = _number;
}
}
And I'm trying to write a test in javascript to call the function setNumber. My test.js looks like this:
var HelloWorld = artifacts.require('./HelloWorld.sol');
contract("HelloWorld:getName", function(accounts) {
it("should assert true", async function() {
const contract = await HelloWorld.deployed();
await contract.setNumber(54);
await contract.getNumber();
const result = await contract.getNumber.call();
assert.isTrue(result === 54);
});
});
But I am getting the following error:
Contract: HelloWorld:getName
1) should assert true
> No events were emitted
0 passing (241ms)
1 failing
1) Contract: HelloWorld:getName should assert true:
AssertionError: expected false to be true
Can someone help me with the syntax? Or point me in the direction for learning?
Thanks in advance..