Added tests for start command.
This commit is contained in:
parent
4f37c3f15f
commit
81b2d2f2a3
@ -41,6 +41,9 @@ function start(options) {
|
||||
// expand to the full path
|
||||
fullConfig.datadir = path.resolve(configPath, config.datadir);
|
||||
|
||||
// delete until modules move to the node
|
||||
delete fullConfig.modules;
|
||||
|
||||
// load the modules
|
||||
fullConfig.db = {
|
||||
modules: modules
|
||||
@ -208,6 +211,8 @@ function start(options) {
|
||||
//catches ctrl+c event
|
||||
process.on('SIGINT', exitHandler.bind(null, {sigint:true}));
|
||||
|
||||
return node;
|
||||
|
||||
}
|
||||
|
||||
module.exports = start;
|
||||
|
||||
@ -2,27 +2,38 @@
|
||||
|
||||
var should = require('chai').should();
|
||||
var sinon = require('sinon');
|
||||
var proxyquire = require('proxyquire');
|
||||
var AddressModule = require('../../lib/modules/address');
|
||||
|
||||
describe('#start', function() {
|
||||
|
||||
before(function() {
|
||||
// setup testing directories
|
||||
});
|
||||
|
||||
after(function() {
|
||||
// cleanup testing directories
|
||||
});
|
||||
|
||||
describe('will dynamically create a node from a configuration', function() {
|
||||
|
||||
it('require each bitcore-node module', function() {
|
||||
it('require each bitcore-node module', function(done) {
|
||||
var node;
|
||||
var TestNode = function(options) {
|
||||
options.db.modules.should.deep.equal([AddressModule]);
|
||||
};
|
||||
TestNode.prototype.on = sinon.stub();
|
||||
TestNode.prototype.chain = {
|
||||
on: sinon.stub()
|
||||
};
|
||||
|
||||
var starttest = proxyquire('../../lib/scaffold/start', {
|
||||
'../node': TestNode
|
||||
});
|
||||
|
||||
node = starttest({
|
||||
path: __dirname,
|
||||
config: {
|
||||
modules: [
|
||||
'address'
|
||||
],
|
||||
datadir: './data'
|
||||
}
|
||||
});
|
||||
node.should.be.instanceof(TestNode);
|
||||
done();
|
||||
});
|
||||
|
||||
it('create an instance of node with modules enabled', function() {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user