2018-06-01 13:35:15 -04:00
|
|
|
/*global contract, before, it, embark, web3*/
|
|
|
|
const assert = require('assert');
|
|
|
|
const SimpleStorage = embark.require('contracts/SimpleStorage');
|
2018-01-15 09:51:45 -05:00
|
|
|
|
2018-06-01 13:35:15 -04:00
|
|
|
contract("SimpleStorage", function () {
|
2018-01-05 15:10:47 -05:00
|
|
|
this.timeout(0);
|
2018-01-15 09:51:45 -05:00
|
|
|
|
2018-06-01 13:35:15 -04:00
|
|
|
before(function (done) {
|
|
|
|
const contractsConfig = {
|
|
|
|
contracts: {
|
|
|
|
"SimpleStorage": {
|
|
|
|
args: [100]
|
|
|
|
}
|
2017-02-09 19:38:02 -05:00
|
|
|
}
|
|
|
|
};
|
2018-06-01 13:35:15 -04:00
|
|
|
embark.config(contractsConfig, () => {
|
|
|
|
done();
|
|
|
|
});
|
2017-02-09 19:38:02 -05:00
|
|
|
});
|
|
|
|
|
2018-06-01 13:35:15 -04:00
|
|
|
it("should set constructor value", async function () {
|
|
|
|
let result = await SimpleStorage.contract.methods.storedData().call();
|
|
|
|
assert.strictEqual(parseInt(result, 10), 100);
|
2017-02-09 19:38:02 -05:00
|
|
|
});
|
|
|
|
|
2018-06-01 13:35:15 -04:00
|
|
|
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);
|
2017-02-09 19:38:02 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|