2016-10-14 11:01:54 +00:00
|
|
|
/*globals describe, it*/
|
2017-03-30 11:12:39 +00:00
|
|
|
const Blockchain = require('../lib/cmds/blockchain/blockchain');
|
|
|
|
// let BlockchainClient = require('../lib/cmds/blockchain/blockchain_client');
|
|
|
|
const assert = require('assert');
|
2015-07-03 12:53:42 +00:00
|
|
|
|
2016-10-14 11:01:54 +00:00
|
|
|
describe('embark.Blockchain', function() {
|
2017-03-29 17:57:22 +00:00
|
|
|
//let Client = function() {};
|
2016-10-14 11:01:54 +00:00
|
|
|
//Client.prototype.name = "ClientName";
|
|
|
|
|
|
|
|
describe('#initializer', function() {
|
2017-03-29 17:57:22 +00:00
|
|
|
//let client = new Client();
|
2016-10-14 11:01:54 +00:00
|
|
|
|
|
|
|
describe('with empty config', function() {
|
|
|
|
it('should have a default config', function() {
|
2017-03-29 17:57:22 +00:00
|
|
|
let config = {
|
2017-03-30 11:12:39 +00:00
|
|
|
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: "",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let blockchain = new Blockchain(config, 'geth');
|
2016-10-14 11:01:54 +00:00
|
|
|
|
|
|
|
assert.deepEqual(blockchain.config, config);
|
|
|
|
});
|
2015-07-03 12:53:42 +00:00
|
|
|
});
|
|
|
|
|
2016-10-14 11:01:54 +00:00
|
|
|
describe('with config', function() {
|
|
|
|
it('should take config params', function() {
|
2017-03-29 17:57:22 +00:00
|
|
|
let config = {
|
2016-10-14 11:01:54 +00:00
|
|
|
networkType: 'livenet',
|
|
|
|
genesisBlock: 'foo/bar/genesis.json',
|
2017-02-18 13:55:33 +00:00
|
|
|
geth_bin: 'geth',
|
2016-10-14 11:01:54 +00:00
|
|
|
datadir: '/foo/datadir/',
|
|
|
|
mineWhenNeeded: true,
|
|
|
|
rpcHost: 'someserver',
|
|
|
|
rpcPort: 12345,
|
2017-02-18 13:41:18 +00:00
|
|
|
rpcApi: ['eth', 'web3', 'net'],
|
2016-10-14 11:01:54 +00:00
|
|
|
rpcCorsDomain: true,
|
|
|
|
networkId: 1,
|
|
|
|
port: 123456,
|
|
|
|
nodiscover: true,
|
2016-10-31 00:35:11 +00:00
|
|
|
maxpeers: 25,
|
2016-10-14 11:01:54 +00:00
|
|
|
mine: true,
|
2017-02-18 13:41:18 +00:00
|
|
|
vmdebug: false,
|
2016-10-14 11:01:54 +00:00
|
|
|
whisper: false,
|
2017-02-18 13:24:23 +00:00
|
|
|
account: {},
|
|
|
|
bootnodes: ""
|
2016-10-14 11:01:54 +00:00
|
|
|
};
|
2017-03-30 11:12:39 +00:00
|
|
|
let blockchain = new Blockchain(config, 'geth');
|
2016-10-14 11:01:54 +00:00
|
|
|
|
|
|
|
assert.deepEqual(blockchain.config, config);
|
2015-07-03 12:53:42 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-10-14 11:01:54 +00:00
|
|
|
});
|
2015-07-03 12:53:42 +00:00
|
|
|
});
|