1
- import { Subscription , of } from 'rxjs' ;
1
+ import { Subscription , of , Observable } from 'rxjs' ;
2
2
import { LoadActiveEntry , EntryActionTypes , UpdateEntry } from './../../store/entry.actions' ;
3
3
import { ActivityManagementActionTypes } from './../../../activities-management/store/activity-management.actions' ;
4
4
import { waitForAsync , ComponentFixture , TestBed } from '@angular/core/testing' ;
@@ -430,7 +430,7 @@ describe('EntryFieldsComponent', () => {
430
430
expect ( component . actionSetDateSubscription . unsubscribe ) . toHaveBeenCalled ( ) ;
431
431
} ) ;
432
432
433
- it ( 'The flag "update_last_entry_if_overlap" is added to the "newData" when feature flag "update-entries" is enabled for user ' , ( ) => {
433
+ it ( 'when feature-toggle "update-entries" enable for the user, the updateEntry function is executes to update the entries ' , ( ) => {
434
434
spyOn ( featureManagerService , 'isToggleEnabledForUser' ) . and . returnValue ( of ( true ) ) ;
435
435
436
436
const mockEntry = { ...entry ,
@@ -444,7 +444,7 @@ describe('EntryFieldsComponent', () => {
444
444
expect ( component . newData . update_last_entry_if_overlap ) . toEqual ( expected . update_last_entry_if_overlap ) ;
445
445
} ) ;
446
446
447
- it ( 'The flag "update_last_entry_if_overlap" is not added to the "newData" when feature flag " update-entries" is disable for user ' , ( ) => {
447
+ it ( 'when FT "update-entries" disable for the user, the UpdateCurrentOrLastEntry function is called to update the entries ' , ( ) => {
448
448
spyOn ( featureManagerService , 'isToggleEnabledForUser' ) . and . returnValue ( of ( false ) ) ;
449
449
450
450
const mockEntry = { ...entry ,
@@ -457,4 +457,25 @@ describe('EntryFieldsComponent', () => {
457
457
const expected = { update_last_entry_if_overlap : false } ;
458
458
expect ( component . newData . update_last_entry_if_overlap ) . toEqual ( expected . update_last_entry_if_overlap ) ;
459
459
} ) ;
460
+
461
+ const toggleValues = [ true , false ] ;
462
+ toggleValues . map ( ( toggleValue ) => {
463
+ it ( `when FeatureToggle is ${ toggleValue } should return ${ toggleValue } ` , ( ) => {
464
+ spyOn ( featureManagerService , 'isToggleEnabledForUser' ) . and . returnValue ( of ( toggleValue ) ) ;
465
+
466
+ const isFeatureToggleActivated : Observable < boolean > = component . isFeatureToggleActivated ( ) ;
467
+
468
+ expect ( featureManagerService . isToggleEnabledForUser ) . toHaveBeenCalled ( ) ;
469
+ isFeatureToggleActivated . subscribe ( ( value ) => expect ( value ) . toEqual ( toggleValue ) ) ;
470
+ } ) ;
471
+ } ) ;
472
+
473
+ // fit('should return the id of the active user', () => {
474
+
475
+ // const userId = 'user_id';
476
+
477
+ // expect( component.getOwnerId()).
478
+ // });
460
479
} ) ;
480
+
481
+
0 commit comments