@@ -25,11 +25,6 @@ describe('IderComponent', () => {
25
25
26
26
it ( 'should create' , ( ) => {
27
27
expect ( component ) . toBeTruthy ( )
28
- expect ( component . ider ) . toBeInstanceOf ( AMTIDER )
29
- expect ( component . redirector ) . toBeInstanceOf ( AMTRedirector )
30
- expect ( component . mpsServer ) . toEqual ( '' )
31
- expect ( component . deviceId ) . toEqual ( '' )
32
- expect ( component . authToken ) . toEqual ( '' )
33
28
} )
34
29
35
30
it ( 'should correctly instantiate redirector and ider' , ( ) => {
@@ -41,6 +36,10 @@ describe('IderComponent', () => {
41
36
42
37
expect ( component . redirector ) . toBeTruthy ( )
43
38
expect ( component . ider ) . toBeTruthy ( )
39
+
40
+ expect ( component . ider ) . toBeInstanceOf ( AMTIDER )
41
+ expect ( component . redirector ) . toBeInstanceOf ( AMTRedirector )
42
+
44
43
expect ( component . redirector ?. server ) . toEqual ( 'testServer' )
45
44
expect ( component . redirector ?. authToken ) . toEqual ( 'testToken' )
46
45
expect ( component . redirector ?. host ) . toEqual ( 'testDeviceId' )
@@ -64,22 +63,17 @@ describe('IderComponent', () => {
64
63
expect ( component . stopIder ) . toHaveBeenCalled ( )
65
64
} )
66
65
67
- it ( 'should call instantiate in ngAfterViewInit' , ( ) => {
68
- spyOn ( component , 'instantiate' )
69
- component . ngAfterViewInit ( )
70
- expect ( component . instantiate ) . toHaveBeenCalled ( )
71
- } )
72
-
73
66
it ( 'should emit updated iderData' , ( ) => {
74
67
spyOn ( component . iderData , 'emit' )
68
+ component . instantiate ( )
75
69
component . iderSectorStats ( 1 , 0 , 0 , 0 , 2 )
76
70
expect ( component . iderData . emit ) . toHaveBeenCalled ( )
77
71
} )
78
72
79
73
it ( 'should stop ider' , ( ) => {
80
74
const redirectorSpy = spyOn ( AMTRedirector . prototype , 'stop' )
81
75
const cleanupSpy = spyOn ( component , 'cleanup' )
82
-
76
+ component . instantiate ( )
83
77
component . stopIder ( )
84
78
85
79
expect ( component . ider ) . not . toBeNull ( )
@@ -90,6 +84,7 @@ describe('IderComponent', () => {
90
84
91
85
it ( 'should stop ider on destroy' , ( ) => {
92
86
const stopSpy = spyOn ( AMTIDER . prototype , 'stop' )
87
+ component . instantiate ( )
93
88
component . ngOnDestroy ( )
94
89
expect ( stopSpy ) . toHaveBeenCalled ( )
95
90
} )
0 commit comments