diff --git a/lib/cmds/blockchain/blockchain.js b/lib/cmds/blockchain/blockchain.js index 78a06449..1162fd80 100644 --- a/lib/cmds/blockchain/blockchain.js +++ b/lib/cmds/blockchain/blockchain.js @@ -18,7 +18,7 @@ class Blockchain { constructor(options) { this.blockchainConfig = options.blockchainConfig; this.env = options.env || 'development'; - this.client = BlockchainClient(this.blockchainConfig, 'geth', this.env); + this.client = options.client; this.config = { geth_bin: this.blockchainConfig.geth_bin || 'geth', @@ -47,18 +47,18 @@ class Blockchain { return shelljs.exec(cmd); } -run () { - var self = this; - console.log("===============================================================================".magenta); - console.log("===============================================================================".magenta); - console.log(("Embark Blockchain Using: " + this.client.name.underline).magenta); - console.log("===============================================================================".magenta); - console.log("===============================================================================".magenta); - let address = this.initChainAndGetAddress(); - this.client.mainCommand(address, function(cmd) { - shelljs.exec(cmd, {async : true}); - }); -} + run () { + var self = this; + console.log("===============================================================================".magenta); + console.log("===============================================================================".magenta); + console.log(("Embark Blockchain Using: " + this.client.name.underline).magenta); + console.log("===============================================================================".magenta); + console.log("===============================================================================".magenta); + let address = this.initChainAndGetAddress(); + this.client.mainCommand(address, function(cmd) { + shelljs.exec(cmd, {async : true}); + }); + } initChainAndGetAddress() { let address = null, result; diff --git a/test/blockchain.js b/test/blockchain.js index befdd310..25e7b9c6 100644 --- a/test/blockchain.js +++ b/test/blockchain.js @@ -1,47 +1,45 @@ /*globals describe, it*/ const Blockchain = require('../lib/cmds/blockchain/blockchain'); -// let BlockchainClient = require('../lib/cmds/blockchain/blockchain_client'); + const assert = require('assert'); -describe('embark.Blockchain', function() { +describe('embark.Blockchain', function () { //let Client = function() {}; //Client.prototype.name = "ClientName"; - describe('#initializer', function() { + describe('#initializer', function () { //let client = new Client(); - describe('with empty config', function() { - it('should have a default config', function() { + describe('with empty config', function () { + it('should have a default config', function () { let config = { - blockchainConfig: { - networkType: 'custom', - genesisBlock: false, - geth_bin: 'geth', - datadir: false, - mineWhenNeeded: false, - rpcHost: 'localhost', - rpcPort: 8545, - rpcApi: ['eth', 'web3', 'net'], - rpcCorsDomain: false, - networkId: 12301, - port: 30303, - nodiscover: false, - maxpeers: 25, - mine: false, - vmdebug: false, - whisper: true, - account: {}, - bootnodes: "", - } - } + networkType: 'custom', + genesisBlock: false, + geth_bin: 'geth', + datadir: false, + mineWhenNeeded: false, + rpcHost: 'localhost', + rpcPort: 8545, + rpcApi: ['eth', 'web3', 'net'], + rpcCorsDomain: false, + networkId: 12301, + port: 30303, + nodiscover: false, + maxpeers: 25, + mine: false, + vmdebug: false, + whisper: true, + account: {}, + bootnodes: "" + }; let blockchain = new Blockchain(config, 'geth'); assert.deepEqual(blockchain.config, config); }); }); - describe('with config', function() { - it('should take config params', function() { + describe('with config', function () { + it('should take config params', function () { let config = { networkType: 'livenet', genesisBlock: 'foo/bar/genesis.json',