@@ -17,7 +17,6 @@ import * as moment from 'moment';
1717import { DATE_FORMAT_YEAR } from 'src/environments/environment' ;
1818import { CookieService } from 'ngx-cookie-service' ;
1919import { FeatureToggleGeneralService } from './../../../shared/feature-toggles/feature-toggle-general/feature-toggle-general.service' ;
20- import { FeatureToggle } from 'src/environments/enum' ;
2120
2221
2322describe ( 'EntryFieldsComponent' , ( ) => {
@@ -440,124 +439,6 @@ describe('EntryFieldsComponent', () => {
440439 expect ( component . actionSetDateSubscription . unsubscribe ) . toHaveBeenCalled ( ) ;
441440 } ) ;
442441
443- it ( 'when feature-toggle "update-entries" enable for the user, the updateEntry function is executes to update the entries' , ( ) => {
444- spyOn ( store , 'dispatch' ) ;
445- const expected = { update_last_entry_if_overlap : true } ;
446- const mockEntry = {
447- ...entry ,
448- start_date : moment ( ) . format ( DATE_FORMAT_YEAR ) ,
449- start_hour : moment ( ) . format ( 'HH:mm' )
450- } ;
451- const lastMockEntry = {
452- ...entry ,
453- end_date : moment ( ) . format ( DATE_FORMAT_YEAR ) ,
454- end_hour : moment ( ) . format ( 'HH:mm' )
455- } ;
456- const hourInTheFuture = moment ( ) . format ( 'HH:mm' ) ;
457- component . newData = mockEntry ;
458- component . activeEntry = mockEntry ;
459- component . lastEntry = lastMockEntry ;
460- component . isFeatureToggleActive = true ;
461- component . entryForm . patchValue ( { start_hour : hourInTheFuture } ) ;
462-
463- component . onUpdateStartHour ( ) ;
464-
465- expect ( component . newData . update_last_entry_if_overlap ) . toEqual ( expected . update_last_entry_if_overlap ) ;
466- expect ( store . dispatch ) . toHaveBeenCalled ( ) ;
467- } ) ;
468-
469- it ( 'Set true in isCookieFeatureToggleActive when feature-toggle "feature-toggle-in-cookies" is enable for user' , ( ) => {
470- const expectedValue = true ;
471- spyOn ( featureToggleGeneralService , 'isActivated' ) . and . returnValue ( of ( true ) ) ;
472-
473- component . ngOnInit ( ) ;
474-
475- expect ( component . isCookieFeatureToggleActive ) . toEqual ( expectedValue ) ;
476- } ) ;
477-
478- it ( 'Set false in isCookieFeatureToggleActive when feature-toggle "feature-toggle-in-cookies" is not enable for user' , ( ) => {
479- const expectedValue = false ;
480- spyOn ( featureToggleGeneralService , 'isActivated' ) . and . returnValue ( of ( false ) ) ;
481-
482- component . ngOnInit ( ) ;
483-
484- expect ( component . isCookieFeatureToggleActive ) . toEqual ( expectedValue ) ;
485- } ) ;
486-
487-
488- it ( 'Call cookieService.get() when isCookieFeatureToggleActive is True' , ( ) => {
489- const expectedValue = true ;
490- component . isCookieFeatureToggleActive = expectedValue ;
491- spyOn ( cookieService , 'get' ) . and . returnValue ( `${ expectedValue } ` ) ;
492-
493- component . ngOnInit ( ) ;
494-
495- expect ( cookieService . get ) . toHaveBeenCalledWith ( FeatureToggle . UPDATE_ENTRIES ) ;
496- } ) ;
497-
498- it ( 'Call featureToggleGeneralService.isActivated() when isCookieFeatureToggleActive is False' , ( ) => {
499- const expectedValue = false ;
500- spyOn ( featureToggleGeneralService , 'isActivated' ) . and . returnValue ( of ( expectedValue ) ) ;
501-
502- component . ngOnInit ( ) ;
503-
504- expect ( featureToggleGeneralService . isActivated ) . toHaveBeenCalledWith ( FeatureToggle . UPDATE_ENTRIES ) ;
505- } ) ;
506-
507- it ( 'Set True in isFeatureToggleActive when cookieService.get() return "true" and isCookieFeatureToggleActive is true' , ( ) => {
508- const expectedValue = true ;
509- component . isCookieFeatureToggleActive = expectedValue ;
510- spyOn ( cookieService , 'get' ) . and . returnValue ( `${ expectedValue } ` ) ;
511-
512- component . ngOnInit ( ) ;
513-
514- expect ( component . isFeatureToggleActive ) . toEqual ( expectedValue ) ;
515- } ) ;
516-
517- it ( 'Set True in isFeatureToggleActive when cookieService.get() return "false" and isCookieFeatureToggleActive is true' , ( ) => {
518- const expectedValue = false ;
519- component . isCookieFeatureToggleActive = ! expectedValue ;
520- spyOn ( cookieService , 'get' ) . and . returnValue ( `${ expectedValue } ` ) ;
521-
522- component . ngOnInit ( ) ;
523-
524- expect ( component . isFeatureToggleActive ) . toEqual ( expectedValue ) ;
525- } ) ;
526-
527- it ( 'Set True in isFeatureToggleActive when featureToggleGeneralService.isActivated() return true' , ( ) => {
528- const expectedValue = true ;
529- spyOn ( featureToggleGeneralService , 'isActivated' ) . and . callFake (
530- ( featureToggle ) => featureToggle === FeatureToggle . COOKIES ? of ( false ) : of ( true ) ) ;
531-
532- component . ngOnInit ( ) ;
533-
534- expect ( featureToggleGeneralService . isActivated ) . toHaveBeenCalledWith ( FeatureToggle . UPDATE_ENTRIES ) ;
535- expect ( component . isFeatureToggleActive ) . toEqual ( expectedValue ) ;
536- } ) ;
537-
538- it ( 'Set False in isFeatureToggleActive when featureToggleGeneralService.isActivated() return false and isCookieFeatureToggleActive is false' , ( ) => {
539- const expectedValue = false ;
540- spyOn ( featureToggleGeneralService , 'isActivated' ) . and . returnValue ( of ( expectedValue ) ) ;
541-
542- component . ngOnInit ( ) ;
543-
544- expect ( component . isFeatureToggleActive ) . toEqual ( expectedValue ) ;
545- } ) ;
546-
547- it ( 'when FT "update-entries" disable for the user,the UpdateCurrentOrLastEntry function is called to update the entries' , ( ) => {
548- spyOn ( featureToggleGeneralService , 'isActivated' ) . and . returnValue ( of ( false ) ) ;
549-
550- const mockEntry = {
551- ...entry ,
552- start_date : moment ( ) . format ( DATE_FORMAT_YEAR ) ,
553- start_hour : moment ( ) . format ( 'HH:mm' )
554- } ;
555- component . newData = mockEntry ;
556- featureToggleGeneralService . isActivated ( FeatureToggle . UPDATE_ENTRIES ) . subscribe ( ( ) => {
557- expect ( featureToggleGeneralService . isActivated ) . toHaveBeenCalled ( ) ;
558- } ) ;
559- } ) ;
560-
561442 it ( 'when a activity is not register in DB should show activatefocus in select activity' , ( ) => {
562443 const activitiesMock = [ {
563444 id : 'xyz' ,
0 commit comments