embark/test_app/test/simple_storage_spec.js

37 lines
765 B
JavaScript
Raw Normal View History

2018-01-15 14:51:45 +00:00
2018-01-05 20:10:47 +00:00
contract("SimpleStorage", function() {
2018-01-15 14:51:45 +00:00
2018-01-05 20:10:47 +00:00
this.timeout(0);
2017-02-10 00:38:02 +00:00
before(function(done) {
this.timeout(0);
2018-01-15 14:51:45 +00:00
//config({
// node: "http://localhost:8545"
//});
2018-01-15 14:51:45 +00:00
2017-02-10 00:38:02 +00:00
var contractsConfig = {
"SimpleStorage": {
args: [100]
}
};
2017-12-22 18:07:43 +00:00
EmbarkSpec.deployAll(contractsConfig, () => { done() });
2017-02-10 00:38:02 +00:00
});
it("should set constructor value", function(done) {
2018-01-05 20:10:47 +00:00
SimpleStorage.methods.storedData().call().then(function(result) {
assert.equal(result, 100);
2017-02-10 00:38:02 +00:00
done();
});
});
it("set storage value", function(done) {
2018-01-12 23:08:44 +00:00
SimpleStorage.methods.set(150).send().then(function() {
2018-01-05 20:10:47 +00:00
SimpleStorage.methods.get().call().then(function(result) {
2018-01-13 16:38:10 +00:00
assert.equal(result, 499650);
2017-02-10 00:38:02 +00:00
done();
});
});
});
});