Hi there! Sorry for google translate. I need help.
I use truffle framework. And when I try to write data into a contract, nothing happens.
It is code in my test:
contract('SomeToken', (accounts) => {
beforeEach(async () => {
Token = await TokenContract.new({from: accounts[0]});
});
it('write the test data.', async () => {
const result = await Token.testAdd.call(100, {from: accounts[0]});
assert.strictEqual(result, true); // passed
const testSum1 = await Token.testGet.call();
assert.strictEqual(testSum1, 200); // failed
});
});
It is code in my contract:
uint256 test = 100;
function testAdd(uint256 _plus) returns (bool) {
test = test.add(_plus); // SafeMath by zeppelin
return true;
}
function testGet() returns (uint256){
return test;
}
This code is for test purposes only.
Please tell me where is the mistake?
Feb 2, 2018, 12:16 PM