embark/test_apps/contracts_app/test/simple_storage_spec.js
2018-06-01 13:35:18 -04:00

34 lines
882 B
JavaScript

/*global contract, before, it, embark, web3*/
const assert = require('assert');
const SimpleStorage = embark.require('contracts/SimpleStorage');
contract("SimpleStorage", function () {
this.timeout(0);
before(function (done) {
const contractsConfig = {
contracts: {
"SimpleStorage": {
args: [100]
}
}
};
embark.config(contractsConfig, () => {
done();
});
});
it("should set constructor value", async function () {
let result = await SimpleStorage.methods.storedData().call();
assert.strictEqual(parseInt(result, 10), 100);
});
it("set storage value", async function () {
// TODO Solve from
await SimpleStorage.methods.set(150).send({from: web3.eth.defaultAccount});
let result = await SimpleStorage.methods.get().call();
assert.strictEqual(parseInt(result, 10), 499650);
});
});