diff --git a/demo/spec/contracts/simple_storage_spec.js b/demo/spec/contracts/simple_storage_spec.js index 7d34c9135..71d654e4a 100644 --- a/demo/spec/contracts/simple_storage_spec.js +++ b/demo/spec/contracts/simple_storage_spec.js @@ -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]); }); diff --git a/lib/index.js b/lib/index.js index 19bb8b7cd..39986509f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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; diff --git a/lib/test.js b/lib/test.js new file mode 100644 index 000000000..d62cdd587 --- /dev/null +++ b/lib/test.js @@ -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; diff --git a/package.json b/package.json index 3d693ce6e..9fdaea594 100644 --- a/package.json +++ b/package.json @@ -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 ", "contributors": [],