2015-10-12 14:50:52 +00:00
|
|
|
var assert = require('assert');
|
2016-08-21 22:05:35 +00:00
|
|
|
//var Embark = require('embark-framework');
|
|
|
|
|
|
|
|
var SimpleStorage;
|
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) {
|
2016-08-21 22:05:35 +00:00
|
|
|
var self = this;
|
|
|
|
|
|
|
|
var Embark = require('../../lib/index.js');
|
|
|
|
var EmbarkSpec = Embark.initTests();
|
|
|
|
//var web3 = EmbarkSpec.web3;
|
|
|
|
|
|
|
|
//var contracts = EmbarkSpec.deployAll(done);
|
|
|
|
//var SimpleStorage = contracts.SimpleStorage;
|
|
|
|
// or
|
|
|
|
EmbarkSpec.deployContract('SimpleStorage', [100], function(contract) {
|
|
|
|
SimpleStorage = contract;
|
|
|
|
done();
|
2016-05-30 00:14:27 +00:00
|
|
|
});
|
2015-10-12 14:50:52 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should set constructor value", function(done) {
|
2016-08-21 22:05:35 +00:00
|
|
|
SimpleStorage.storedData()
|
|
|
|
.then(function(value) {
|
|
|
|
assert.equal(value.toNumber(), 100);
|
2015-10-12 14:50:52 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("set storage value", function(done) {
|
2016-08-21 22:05:35 +00:00
|
|
|
var self = this;
|
|
|
|
//console.log(SimpleStorage);
|
|
|
|
SimpleStorage.set(150)
|
|
|
|
.then(function() {
|
|
|
|
return SimpleStorage.get();
|
|
|
|
})
|
|
|
|
.then(function(value) {
|
|
|
|
assert.equal(value.toNumber(), 150);
|
2015-10-12 14:50:52 +00:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-08-10 11:59:23 +00:00
|
|
|
});
|