embark/templates/demo/test/simple_storage_spec.js

26 lines
642 B
JavaScript
Raw Normal View History

2018-06-18 15:15:24 -04:00
/*global contract, config, it, assert*/
const SimpleStorage = require('Embark/contracts/SimpleStorage');
config({
contracts: {
"SimpleStorage": {
args: [100]
}
}
});
contract("SimpleStorage", function () {
2018-01-12 18:11:24 -05:00
this.timeout(0);
2015-10-12 10:50:52 -04:00
2018-06-18 15:15:24 -04:00
it("should set constructor value", async function () {
2018-04-17 14:48:31 -04:00
let result = await SimpleStorage.methods.storedData().call();
2018-06-18 15:15:24 -04:00
assert.strictEqual(parseInt(result, 10), 100);
2015-10-12 10:50:52 -04:00
});
2018-06-18 15:15:24 -04:00
it("set storage value", async function () {
2018-04-17 14:48:31 -04:00
await SimpleStorage.methods.set(150).send();
2018-05-31 13:19:25 +10:00
let result = await SimpleStorage.methods.get().call();
2018-06-18 15:15:24 -04:00
assert.strictEqual(parseInt(result, 10), 150);
2015-10-12 10:50:52 -04:00
});
});