embark/dapps/tests/contracts/test/simple_storage_spec.js

30 lines
778 B
JavaScript
Raw Normal View History

/*global artifacts, contract, config, it*/
2018-06-01 17:35:15 +00:00
const assert = require('assert');
const SimpleStorage = artifacts.require('SimpleStorage');
config({
contracts: {
deploy: {
"SimpleStorage": {
args: [100]
}
}
}
});
2018-06-01 17:35:15 +00:00
contract("SimpleStorage", function () {
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 () {
this.timeout(0);
const toSend = SimpleStorage.methods.set(150);
const gas = await toSend.estimateGas();
await toSend.send({gas});
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
});
});