embark/test/blockchain.js

70 lines
1.8 KiB
JavaScript
Raw Normal View History

/*globals describe, it*/
2015-07-03 12:53:42 +00:00
var Blockchain = require('../lib/blockchain.js');
var assert = require('assert');
describe('embark.Blockchain', function() {
//var Client = function() {};
//Client.prototype.name = "ClientName";
describe('#initializer', function() {
//var client = new Client();
describe('with empty config', function() {
it('should have a default config', function() {
var config = {
networkType: 'custom',
genesisBlock: false,
2017-02-18 13:55:33 +00:00
geth_bin: 'geth',
datadir: false,
mineWhenNeeded: false,
rpcHost: 'localhost',
rpcPort: 8545,
2017-02-18 13:41:18 +00:00
rpcApi: ['eth', 'web3', 'net'],
rpcCorsDomain: false,
networkId: 12301,
port: 30303,
nodiscover: false,
2016-10-31 00:35:11 +00:00
maxpeers: 25,
mine: false,
2017-02-18 13:41:18 +00:00
vmdebug: false,
whisper: true,
2017-02-18 13:24:23 +00:00
account: {},
bootnodes: ""
};
var blockchain = Blockchain(config, 'geth');
assert.deepEqual(blockchain.config, config);
});
2015-07-03 12:53:42 +00:00
});
describe('with config', function() {
it('should take config params', function() {
var config = {
networkType: 'livenet',
genesisBlock: 'foo/bar/genesis.json',
2017-02-18 13:55:33 +00:00
geth_bin: 'geth',
datadir: '/foo/datadir/',
mineWhenNeeded: true,
rpcHost: 'someserver',
rpcPort: 12345,
2017-02-18 13:41:18 +00:00
rpcApi: ['eth', 'web3', 'net'],
rpcCorsDomain: true,
networkId: 1,
port: 123456,
nodiscover: true,
2016-10-31 00:35:11 +00:00
maxpeers: 25,
mine: true,
2017-02-18 13:41:18 +00:00
vmdebug: false,
whisper: false,
2017-02-18 13:24:23 +00:00
account: {},
bootnodes: ""
};
var blockchain = Blockchain(config, 'geth');
assert.deepEqual(blockchain.config, config);
2015-07-03 12:53:42 +00:00
});
});
});
2015-07-03 12:53:42 +00:00
});