22
22
23
23
define ( [
24
24
'./MCT' ,
25
- './plugins/plugins'
26
- ] , function ( MCT , plugins ) {
25
+ './plugins/plugins' ,
26
+ 'legacyRegistry'
27
+ ] , function ( MCT , plugins , legacyRegistry ) {
27
28
describe ( "MCT" , function ( ) {
28
29
var openmct ;
29
30
var mockPlugin ;
30
31
var mockPlugin2 ;
32
+ var mockListener ;
33
+ var oldBundles ;
31
34
32
35
beforeEach ( function ( ) {
33
36
mockPlugin = jasmine . createSpy ( 'plugin' ) ;
34
- mockPlugin2 = jasmine . createSpy ( 'plugin' ) ;
37
+ mockPlugin2 = jasmine . createSpy ( 'plugin2' ) ;
38
+ mockListener = jasmine . createSpy ( 'listener' ) ;
39
+ oldBundles = legacyRegistry . list ( ) ;
35
40
36
41
openmct = new MCT ( ) ;
37
42
38
43
openmct . install ( mockPlugin ) ;
39
44
openmct . install ( mockPlugin2 ) ;
45
+ openmct . on ( 'start' , mockListener ) ;
46
+ } ) ;
47
+
48
+ // Clean up the dirty singleton.
49
+ afterEach ( function ( ) {
50
+ legacyRegistry . list ( ) . forEach ( function ( bundle ) {
51
+ if ( oldBundles . indexOf ( bundle ) === - 1 ) {
52
+ legacyRegistry . delete ( bundle ) ;
53
+ }
54
+ } ) ;
40
55
} ) ;
41
56
42
57
it ( "exposes plugins" , function ( ) {
43
58
expect ( openmct . plugins ) . toEqual ( plugins ) ;
44
59
} ) ;
45
60
61
+ it ( "does not issue a start event before started" , function ( ) {
62
+ expect ( mockListener ) . not . toHaveBeenCalled ( ) ;
63
+ } ) ;
64
+
46
65
describe ( "start" , function ( ) {
47
66
beforeEach ( function ( ) {
48
67
openmct . start ( ) ;
@@ -52,6 +71,10 @@ define([
52
71
expect ( mockPlugin ) . toHaveBeenCalledWith ( openmct ) ;
53
72
expect ( mockPlugin2 ) . toHaveBeenCalledWith ( openmct ) ;
54
73
} ) ;
74
+
75
+ it ( "emits a start event" , function ( ) {
76
+ expect ( mockListener ) . toHaveBeenCalled ( ) ;
77
+ } ) ;
55
78
} ) ;
56
79
57
80
describe ( "setAssetPath" , function ( ) {
0 commit comments