move spec code to lib

This commit is contained in:
Iuri Matias 2015-10-09 10:57:30 -04:00
parent c550b688d3
commit b4d659a3d1
4 changed files with 39 additions and 29 deletions

View File

@ -1,31 +1,8 @@
var Embark = require('embark-framework');
var ethersim = require('ethersim');
var web3 = require('web3');
var Manager = ethersim.Manager;
var Provider = ethersim.Provider;
var manager = new Manager();
web3.setProvider(new Provider(manager));
Embark.init(web3);
Embark.blockchainConfig.loadConfigFile('config/blockchain.yml');
Embark.contractsConfig.loadConfigFile('config/contracts.yml');
var files = ["app/contracts/simple_storage.sol"];
Embark.contractsConfig.init(files, 'development');
console.log("initializing");
var EmbarkSpec = require('embark-framework').test;
describe("SimpleStorage", function() {
beforeAll(function(done) {
Embark.deployContracts('development', files, "/tmp/abi.js", "chains.json", false, function(abi) {
console.log("return abi");
console.log(abi);
eval(abi);
done();
});
EmbarkSpec(done);
//SimpleStorage = EmbarkSpec.request("SimpleStorage", [150]);
});

View File

@ -5,7 +5,6 @@ var shelljs_global = require('shelljs/global');
var web3 = require('web3');
var commander = require('commander');
var wrench = require('wrench');
var python = require('python');
var syncMe = require('sync-me');
var methodmissing = require('methodmissing');
var jasmine = require('jasmine');
@ -17,6 +16,7 @@ var Release = require('./ipfs.js');
var Config = require('./config/config.js');
var Compiler = require('./compiler.js');
var ChainManager = require('./chain_manager.js');
var Test = require('./test.js');
Embark = {
init: function(_web3) {
@ -72,7 +72,11 @@ Embark = {
chain.execGeth(args);
},
release: Release
release: Release,
test: function(cb) {
var tests = new Test(cb);
}
}
module.exports = Embark;

29
lib/test.js Normal file
View File

@ -0,0 +1,29 @@
var ethersim = require('ethersim');
var web3 = require('web3');
Test = function(cb) {
var Manager = ethersim.Manager;
var Provider = ethersim.Provider;
var manager = new Manager();
web3.setProvider(new Provider(manager));
Embark.init(web3);
Embark.blockchainConfig.loadConfigFile('config/blockchain.yml');
Embark.contractsConfig.loadConfigFile('config/contracts.yml');
var files = ["app/contracts/simple_storage.sol"];
Embark.contractsConfig.init(files, 'development');
Embark.deployContracts('development', files, "/tmp/abi.js", "chains.json", false, function(abi) {
console.log("return abi");
console.log(abi);
eval(abi);
cb();
});
}
//Test.prototype.deploy_contract = function(className, params)
module.exports = Test;

View File

@ -21,14 +21,14 @@
"meteor-build-client": "^0.1.6",
"methodmissing": "^0.0.3",
"mkdirp": "^0.5.1",
"python": "^0.0.4",
"read-yaml": "^1.0.0",
"shelljs": "^0.5.0",
"solc": "^0.1.3-2",
"sync-me": "^0.1.1",
"toposort": "^0.2.10",
"web3": "^0.8.1",
"wrench": "^1.5.8"
"wrench": "^1.5.8",
"ethersim": "/Users/iurimatias/Projects/projects/EtherSim"
},
"author": "Iuri Matias <iuri.matias@gmail.com>",
"contributors": [],