@@ -58,7 +58,7 @@ describe('ProjectListHoverComponent', () => {
5858 fixture = TestBed . createComponent ( ProjectListHoverComponent ) ;
5959 component = fixture . componentInstance ;
6060 fixture . detectChanges ( ) ;
61- // featureManagerService = TestBed.inject(FeatureManagerService);
61+ featureManagerService = TestBed . inject ( FeatureManagerService ) ;
6262 } ) ;
6363
6464 it ( 'should create' , ( ) => {
@@ -143,6 +143,36 @@ describe('ProjectListHoverComponent', () => {
143143 expect ( component . projectsForm . setValue )
144144 . toHaveBeenCalledWith ( { project_id : 'customer - xyz' } ) ;
145145 } ) ;
146+
147+ var toggleValue = true ;
148+ fit ( `when FeatureToggle is ${ toggleValue } should return ${ toggleValue } ` , ( ) => {
149+ spyOn ( featureManagerService , 'isToggleEnabledForUser' ) . and . returnValue ( of ( toggleValue ) ) ;
150+ component . projectsSubscription = new Subscription ( ) ;
151+ component . activeEntrySubscription = new Subscription ( ) ;
152+
153+ spyOn ( component . projectsSubscription , 'unsubscribe' ) ;
154+ spyOn ( component . activeEntrySubscription , 'unsubscribe' ) ;
155+
156+ component . ngOnDestroy ( ) ;
157+
158+ expect ( component . projectsSubscription . unsubscribe ) . toHaveBeenCalled ( ) ;
159+ expect ( component . activeEntrySubscription . unsubscribe ) . toHaveBeenCalled ( ) ;
160+ } ) ;
161+
162+ toggleValue = false ;
163+ fit ( `when FeatureToggle is ${ toggleValue } should return ${ toggleValue } ` , ( ) => {
164+ spyOn ( component , 'isFeatureToggleActivated' ) . and . returnValue ( of ( toggleValue ) ) ;
165+ component . projectsSubscription = new Subscription ( ) ;
166+ component . activeEntrySubscription = new Subscription ( ) ;
167+
168+ spyOn ( component . projectsSubscription , 'unsubscribe' ) ;
169+ spyOn ( component . activeEntrySubscription , 'unsubscribe' ) ;
170+
171+ component . ngOnDestroy ( ) ;
172+
173+ expect ( component . projectsSubscription . unsubscribe ) . not . toHaveBeenCalled ( ) ;
174+ expect ( component . activeEntrySubscription . unsubscribe ) . not . toHaveBeenCalled ( ) ;
175+ } ) ;
146176
147177 // const exponentialGrowth = [true, false];
148178 // exponentialGrowth.map((toggleValue) => {
@@ -187,4 +217,5 @@ describe('ProjectListHoverComponent', () => {
187217 // })
188218 // );
189219 // });
220+
190221} ) ;
0 commit comments