@@ -513,23 +513,24 @@ describe('DetailsFieldsComponent', () => {
513513 expect ( endDateInput . max ) . toEqual ( expectedDate ) ;
514514 } ) ;
515515
516- fit ( 'should return the difference if there is data in the time in and in the time out' , ( ) => {
517- component . ngOnChanges ( ) ;
518- const StartHour = '08:00' ;
519- const EndHour = '19:00' ;
520- const StartDate = '2021-04-14' ;
521- const EndDate = '2021-04-15' ;
522- const startDateInput : HTMLInputElement = fixture . debugElement . nativeElement . querySelector ( '#start_date' ) ;
523- const startHourInput : HTMLInputElement = fixture . debugElement . nativeElement . querySelector ( '#start_hour' ) ;
524- const endDateInput : HTMLInputElement = fixture . debugElement . nativeElement . querySelector ( '#end_date' ) ;
525- const endHourInput : HTMLInputElement = fixture . debugElement . nativeElement . querySelector ( '#end_hour' ) ;
526- startDateInput . value = StartDate ;
527- startHourInput . value = StartHour ;
528- endDateInput . value = EndDate ;
529- endHourInput . value = EndHour ;
530- spyOn ( component , 'getTimeDifference' ) ;
531-
532- expect ( component . getTimeDifference ) . toHaveBeenCalled ( ) ;
516+ const diffParams = [
517+ {
518+ case : 'positive should return correctly diff' ,
519+ entryDates : {
520+ start_date : '2021-04-15' ,
521+ end_date : '2021-04-15' ,
522+ start_hour : '18:05' ,
523+ end_hour : '19:00' ,
524+ } ,
525+ expectedTimeDiff : '00:55' ,
526+ } ,
527+ ] ;
528+ diffParams . map ( ( param ) => {
529+ fit ( `if [start_date, start_hour] and [end_date, end_hour] diff is ${ param . case } ` , ( ) => {
530+ component . entryForm . setValue ( { ...formValues , ...param . entryDates } ) ;
531+ const timeDiff = component . getTimeDifference ( ) ;
532+ expect ( timeDiff ) . toBe ( param . expectedTimeDiff ) ;
533+ } ) ;
533534 } ) ;
534535
535536 /*
0 commit comments