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

34 lines
764 B
JavaScript
Raw Normal View History

2015-10-12 14:50:52 +00:00
var assert = require('assert');
var Embark = require('embark')();
2016-10-02 20:57:13 +00:00
var EmbarkSpec = Embark.initTests();
var web3 = EmbarkSpec.web3;
2015-10-12 14:50:52 +00:00
2016-05-30 00:14:27 +00:00
describe("SimpleStorage", function() {
2015-10-12 14:50:52 +00:00
before(function(done) {
this.timeout(0);
2016-10-02 20:57:13 +00:00
var contractsConfig = {
"SimpleStorage": {
2016-10-16 18:52:04 +00:00
args: [100]
2016-10-02 20:57:13 +00:00
}
};
EmbarkSpec.deployAll(contractsConfig, done);
2015-10-12 14:50:52 +00:00
});
it("should set constructor value", function(done) {
2016-10-02 20:57:13 +00:00
SimpleStorage.storedData(function(err, result) {
assert.equal(result.toNumber(), 100);
2015-10-12 14:50:52 +00:00
done();
});
});
it("set storage value", function(done) {
2016-10-02 20:57:13 +00:00
SimpleStorage.set(150, function() {
SimpleStorage.get(function(err, result) {
assert.equal(result.toNumber(), 150);
2015-10-12 14:50:52 +00:00
done();
2016-10-02 20:57:13 +00:00
});
2015-10-12 14:50:52 +00:00
});
});
});