mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[registry] added test
This commit is contained in:
parent
e1c3be378b
commit
9991a197d4
2 changed files with 44 additions and 1 deletions
|
@ -138,7 +138,8 @@
|
|||
'specs/directives/filter_bar',
|
||||
'specs/components/agg_types/index',
|
||||
'specs/components/vis/index',
|
||||
'specs/components/reflow_watcher'
|
||||
'specs/components/reflow_watcher',
|
||||
'specs/registry/index'
|
||||
], function (kibana, sinon) {
|
||||
kibana.load(function () {
|
||||
var xhr = sinon.useFakeXMLHttpRequest();
|
||||
|
|
42
test/unit/specs/registry/index.js
Normal file
42
test/unit/specs/registry/index.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
define(function (require) {
|
||||
describe('Registry', function () {
|
||||
var Registry = require('registry/_registry');
|
||||
var Private;
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(inject(function ($injector) {
|
||||
Private = $injector.get('Private');
|
||||
}));
|
||||
|
||||
it('is technically a function', function () {
|
||||
var reg = new Registry('name');
|
||||
expect(reg).to.be.a('function');
|
||||
});
|
||||
|
||||
describe('#register', function () {
|
||||
it('accepts a Private module', function () {
|
||||
var reg = new Registry('name');
|
||||
var mod = function SomePrivateModule() {
|
||||
|
||||
};
|
||||
|
||||
reg.register(mod);
|
||||
// modules are not exposed, so this is the most that we can test
|
||||
});
|
||||
});
|
||||
|
||||
describe('as a module', function () {
|
||||
it('exposes the list of registered modules', function () {
|
||||
var reg = new Registry('name');
|
||||
var mod = function SomePrivateModule(Private) {
|
||||
this.PrivateModuleLoader = Private;
|
||||
};
|
||||
|
||||
reg.register(mod);
|
||||
var result = Private(reg);
|
||||
expect(result).to.have.length(1);
|
||||
expect(result[0]).to.have.property('PrivateModuleLoader', Private);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue