2018-06-07 20:14:42 +00:00
|
|
|
/*global contract, config, it*/
|
2018-06-01 17:35:15 +00:00
|
|
|
const assert = require('assert');
|
2018-06-07 20:14:42 +00:00
|
|
|
const SimpleStorage = require('Embark/contracts/SimpleStorage');
|
2018-05-30 20:17:17 +00:00
|
|
|
|
2018-05-30 20:17:17 +00:00
|
|
|
config({
|
|
|
|
contracts: {
|
2019-08-30 20:50:20 +00:00
|
|
|
deploy: {
|
|
|
|
"SimpleStorage": {
|
|
|
|
args: [100]
|
|
|
|
}
|
2018-05-30 20:17:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-06-01 17:35:15 +00:00
|
|
|
contract("SimpleStorage", function () {
|
|
|
|
it("should set constructor value", async function () {
|
2018-05-30 12:55:34 +00:00
|
|
|
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 () {
|
2020-01-20 18:25:22 +00:00
|
|
|
this.timeout(0);
|
2019-10-23 18:58:40 +00:00
|
|
|
const toSend = SimpleStorage.methods.set(150);
|
|
|
|
const gas = await toSend.estimateGas();
|
|
|
|
await toSend.send({gas});
|
2018-05-30 12:55:34 +00:00
|
|
|
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
|
|
|
});
|
|
|
|
});
|