embark-area-51/test_apps/contracts_app/test/simple_storage_spec.js

27 lines
686 B
JavaScript
Raw Normal View History

/*global contract, config, it, embark*/
2018-06-01 17:35:15 +00:00
const assert = require('assert');
2018-05-30 21:35:54 +00:00
const SimpleStorage = embark.require('Embark/contracts/SimpleStorage');
config({
contracts: {
"SimpleStorage": {
args: [100]
}
}
});
2018-06-01 17:35:15 +00:00
contract("SimpleStorage", function () {
2018-01-05 20:10:47 +00:00
this.timeout(0);
2018-01-15 14:51:45 +00:00
2018-06-01 17:35:15 +00:00
it("should set constructor value", async function () {
let result = await SimpleStorage.methods.storedData().call();
2018-06-01 17:35:15 +00:00
assert.strictEqual(parseInt(result, 10), 100);
2017-02-10 00:38:02 +00:00
});
2018-06-01 17:35:15 +00:00
it("set storage value", async function () {
2018-05-30 13:06:38 +00:00
await SimpleStorage.methods.set(150).send();
let result = await SimpleStorage.methods.get().call();
2018-06-01 17:35:15 +00:00
assert.strictEqual(parseInt(result, 10), 499650);
2017-02-10 00:38:02 +00:00
});
});