embark-area-51/test_app/test/simple_storage_spec.js

44 lines
971 B
JavaScript
Raw Normal View History

2018-01-05 15:10:47 -05:00
contract("SimpleStorage", function() {
this.timeout(0);
2017-02-09 19:38:02 -05:00
before(function(done) {
this.timeout(0);
2017-02-09 19:38:02 -05:00
var contractsConfig = {
"SimpleStorage": {
args: [100]
2018-01-05 15:10:47 -05:00
},
"AnotherStorage": {
args: ["$SimpleStorage"]
},
"Token": {
deploy: false,
args: [1000]
},
"MyToken": {
instanceOf: "Token"
},
"MyToken2": {
instanceOf: "Token",
args: [2000]
2017-02-09 19:38:02 -05:00
}
};
2017-12-22 13:07:43 -05:00
EmbarkSpec.deployAll(contractsConfig, () => { done() });
2017-02-09 19:38:02 -05:00
});
it("should set constructor value", function(done) {
2018-01-05 15:10:47 -05:00
SimpleStorage.methods.storedData().call().then(function(result) {
assert.equal(result, 100);
2017-02-09 19:38:02 -05:00
done();
});
});
it("set storage value", function(done) {
2018-01-12 18:08:44 -05:00
SimpleStorage.methods.set(150).send().then(function() {
2018-01-05 15:10:47 -05:00
SimpleStorage.methods.get().call().then(function(result) {
2018-01-13 11:38:10 -05:00
assert.equal(result, 499650);
2017-02-09 19:38:02 -05:00
done();
});
});
});
});