2017-02-10 02:05:45 +00:00
|
|
|
var assert = require('assert');
|
2017-03-12 03:23:30 +00:00
|
|
|
var Embark = require('embark');
|
|
|
|
var EmbarkSpec = require('../node_modules/embark/lib/core/test.js');
|
2017-03-12 03:25:10 +00:00
|
|
|
var Embark = require('embark');
|
2017-02-10 02:05:45 +00:00
|
|
|
var EmbarkSpec = Embark.initTests();
|
|
|
|
var web3 = EmbarkSpec.web3;
|
|
|
|
|
|
|
|
describe("Token", function() {
|
|
|
|
before(function(done) {
|
2017-03-12 02:49:12 +00:00
|
|
|
this.timeout(0);
|
2017-02-10 02:05:45 +00:00
|
|
|
var contractsConfig = {
|
|
|
|
"SimpleStorage": {
|
|
|
|
args: [100]
|
|
|
|
},
|
|
|
|
"AnotherStorage": {
|
|
|
|
args: ["$SimpleStorage"]
|
|
|
|
},
|
|
|
|
"Token": {
|
|
|
|
deploy: false,
|
|
|
|
args: [1000]
|
|
|
|
},
|
|
|
|
"MyToken": {
|
|
|
|
instanceOf: "Token"
|
|
|
|
},
|
|
|
|
"MyToken2": {
|
|
|
|
instanceOf: "Token",
|
|
|
|
args: [2000]
|
|
|
|
},
|
|
|
|
"AlreadyDeployedToken": {
|
|
|
|
"address": "0x123",
|
|
|
|
instanceOf: "Token"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
EmbarkSpec.deployAll(contractsConfig, done);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("not deploy Token", function(done) {
|
|
|
|
assert.equal(Token.address, "undefined");
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("not deploy MyToken and MyToken2", function(done) {
|
|
|
|
assert.notEqual(MyToken.address, "undefined");
|
|
|
|
assert.notEqual(MyToken2.address, "undefined");
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("set MyToken Balance correctly", function(done) {
|
|
|
|
MyToken._supply(function(err, result) {
|
|
|
|
assert.equal(result.toNumber(), 1000);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("set MyToken2 Balance correctly", function(done) {
|
|
|
|
MyToken2._supply(function(err, result) {
|
|
|
|
assert.equal(result.toNumber(), 2000);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("get right address", function(done) {
|
|
|
|
assert.equal(AlreadyDeployedToken.address, "0x123");
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|