embark-area-51/test_apps/contracts_app/test/simple_storage_spec.js
Jonathan Rainville 8664570d7c conflict in test
2018-06-01 13:43:43 -04:00

34 lines
909 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.contract.methods.storedData().call();
assert.strictEqual(parseInt(result, 10), 100);
});
it("set storage value", async function () {
// TODO Solve from
await SimpleStorage.contract.methods.set(150).send({from: web3.eth.defaultAccount});
let result = await SimpleStorage.contract.methods.get().call();
assert.strictEqual(parseInt(result, 10), 499650);
});
});