I have the following contract, made extremely simply:
pragma solidity ^0.4.18;
contract Test {
bool completed;
function Test() {
completed = false;
}
function setCompleted() public {
completed = true;
}
function getCompleted() public view returns (bool) {
return completed;
}
}
And I am testing it in javascript like so:
var Test = artifacts.require("./Test.sol");
contract('Test Contract', function(accounts) {
it("should set and get completed", function() {
var TestContract
return Test.deployed().then(function(instance) {
TestContract = instance
return TestContract.getCompleted.call()
.then(function(result) {
console.log(result, 'should be false');
return TestContract.setCompleted.call()
})
.then(function() {
return TestContract.getCompleted.call()
}).then(function(result) {
console.log(result, 'should be true');
})
})
})
})
Shouldn't the call to the setCompleted function update the contract's variable? Am I missing something?