PluginManager coverage tests.
This commit is contained in:
parent
93907dbfd1
commit
f5e0dfa58d
3 changed files with 20 additions and 1 deletions
|
|
@ -13,7 +13,12 @@ function PluginManager(config) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
log.info('Loading plugin: ' + pluginName);
|
log.info('Loading plugin: ' + pluginName);
|
||||||
var pluginClass = require('../plugins/' + pluginName);
|
var pluginClass;
|
||||||
|
if(config.pluginsPath){
|
||||||
|
pluginClass = require(config.pluginsPath + pluginName);
|
||||||
|
} else {
|
||||||
|
pluginClass = require('../plugins/' + pluginName);
|
||||||
|
}
|
||||||
var pluginObj = new pluginClass(config[pluginName]);
|
var pluginObj = new pluginClass(config[pluginName]);
|
||||||
pluginObj.init();
|
pluginObj.init();
|
||||||
this._register(pluginObj, pluginName);
|
this._register(pluginObj, pluginName);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var chai = chai || require('chai');
|
var chai = chai || require('chai');
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
|
var PluginManager = require('../js/models/PluginManager');
|
||||||
|
|
||||||
|
|
||||||
var FakeBlockchain = requireMock('FakeBlockchain');
|
var FakeBlockchain = requireMock('FakeBlockchain');
|
||||||
|
|
@ -411,6 +412,14 @@ describe('Identity model', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('#pluginManager', function() {
|
||||||
|
it('should create a new PluginManager object', function() {
|
||||||
|
var pm = sinon.stub().returns(new PluginManager({plugins: { FakeLocalStorage: true }, pluginsPath: '../../test/mocks/'}));
|
||||||
|
should.exist(pm);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('#joinWallet', function() {
|
describe('#joinWallet', function() {
|
||||||
var opts = {
|
var opts = {
|
||||||
secret: '8WtTuiFTkhP5ao7AF2QErSwV39Cbur6pdMebKzQXFqL59RscXM',
|
secret: '8WtTuiFTkhP5ao7AF2QErSwV39Cbur6pdMebKzQXFqL59RscXM',
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,12 @@
|
||||||
|
|
||||||
function FakeLocalStorage() {
|
function FakeLocalStorage() {
|
||||||
this.ls = {};
|
this.ls = {};
|
||||||
|
this.type = 'DB';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FakeLocalStorage.prototype.init = function() {
|
||||||
|
};
|
||||||
|
|
||||||
FakeLocalStorage.prototype.removeItem = function(key, cb) {
|
FakeLocalStorage.prototype.removeItem = function(key, cb) {
|
||||||
delete this.ls[key];
|
delete this.ls[key];
|
||||||
cb();
|
cb();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue