mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
[Testing] Test start event on MCT
This commit is contained in:
parent
35c457b7fb
commit
b48dd4b63b
@ -22,27 +22,46 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'./MCT',
|
'./MCT',
|
||||||
'./plugins/plugins'
|
'./plugins/plugins',
|
||||||
], function (MCT, plugins) {
|
'legacyRegistry'
|
||||||
|
], function (MCT, plugins, legacyRegistry) {
|
||||||
describe("MCT", function () {
|
describe("MCT", function () {
|
||||||
var openmct;
|
var openmct;
|
||||||
var mockPlugin;
|
var mockPlugin;
|
||||||
var mockPlugin2;
|
var mockPlugin2;
|
||||||
|
var mockListener;
|
||||||
|
var oldBundles;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockPlugin = jasmine.createSpy('plugin');
|
mockPlugin = jasmine.createSpy('plugin');
|
||||||
mockPlugin2 = jasmine.createSpy('plugin');
|
mockPlugin2 = jasmine.createSpy('plugin2');
|
||||||
|
mockListener = jasmine.createSpy('listener');
|
||||||
|
oldBundles = legacyRegistry.list();
|
||||||
|
|
||||||
openmct = new MCT();
|
openmct = new MCT();
|
||||||
|
|
||||||
openmct.install(mockPlugin);
|
openmct.install(mockPlugin);
|
||||||
openmct.install(mockPlugin2);
|
openmct.install(mockPlugin2);
|
||||||
|
openmct.on('start', mockListener);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Clean up the dirty singleton.
|
||||||
|
afterEach(function () {
|
||||||
|
legacyRegistry.list().forEach(function (bundle) {
|
||||||
|
if (oldBundles.indexOf(bundle) === -1) {
|
||||||
|
legacyRegistry.delete(bundle);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("exposes plugins", function () {
|
it("exposes plugins", function () {
|
||||||
expect(openmct.plugins).toEqual(plugins);
|
expect(openmct.plugins).toEqual(plugins);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not issue a start event before started", function () {
|
||||||
|
expect(mockListener).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
describe("start", function () {
|
describe("start", function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
openmct.start();
|
openmct.start();
|
||||||
@ -52,6 +71,10 @@ define([
|
|||||||
expect(mockPlugin).toHaveBeenCalledWith(openmct);
|
expect(mockPlugin).toHaveBeenCalledWith(openmct);
|
||||||
expect(mockPlugin2).toHaveBeenCalledWith(openmct);
|
expect(mockPlugin2).toHaveBeenCalledWith(openmct);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("emits a start event", function () {
|
||||||
|
expect(mockListener).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("setAssetPath", function () {
|
describe("setAssetPath", function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user