@@ -53,7 +53,7 @@ describe('DetailsFieldsComponent', () => {
5353 isLoading : false ,
5454 } ,
5555 activities : {
56- data : [ { id : 'fc5fab41-a21e-4155-9d05-511b956ebd05' , tenant_id : 'ioet' , deleted : null , name : 'abc' } ] ,
56+ data : [ { id : 'fc5fab41-a21e-4155-9d05-511b956ebd05' , tenant_id : 'ioet' , deleted : null , name : 'abc' , status : 'active' } ] ,
5757 isLoading : false ,
5858 message : 'Data fetch successfully!' ,
5959 activityIdToEdit : '' ,
@@ -138,9 +138,9 @@ describe('DetailsFieldsComponent', () => {
138138 it ( 'onSelectedProject project id and name are set using event data' , ( ) => {
139139 spyOn ( component . entryForm , 'patchValue' ) ;
140140
141- component . onSelectedProject ( { id : 'id' , search_field : 'foo' } ) ;
141+ component . onSelectedProject ( { id : 'id' , search_field : 'foo' } ) ;
142142
143- expect ( component . entryForm . patchValue ) . toHaveBeenCalledWith ( { project_id : 'id' , project_name : 'foo' , } ) ;
143+ expect ( component . entryForm . patchValue ) . toHaveBeenCalledWith ( { project_id : 'id' , project_name : 'foo' , } ) ;
144144 } ) ;
145145
146146 it ( 'if form is invalid then saveEntry is not emited' , ( ) => {
@@ -296,7 +296,7 @@ describe('DetailsFieldsComponent', () => {
296296
297297 component . onGoingToWorkOnThisChange ( { currentTarget : { checked : false } } ) ;
298298
299- expect ( component . entryForm . patchValue ) . toHaveBeenCalledWith ( { end_date : '2020-12-30' , end_hour : '09:45' , } ) ;
299+ expect ( component . entryForm . patchValue ) . toHaveBeenCalledWith ( { end_date : '2020-12-30' , end_hour : '09:45' , } ) ;
300300 } ) ;
301301
302302 it ( 'when creating a new entry, then the new entry should be marked as not run' , ( ) => {
@@ -367,7 +367,7 @@ describe('DetailsFieldsComponent', () => {
367367 const startHour = moment ( ) . subtract ( 3 , 'hours' ) . format ( 'HH:mm:ss' ) ;
368368 const expectedStartDate = new Date ( `${ currentDate } T${ startHour . trim ( ) } ` ) ;
369369
370- component . entryToEdit = { ...entryToEdit , start_date : expectedStartDate } ;
370+ component . entryToEdit = { ...entryToEdit , start_date : expectedStartDate } ;
371371 fixture . componentInstance . ngOnChanges ( ) ;
372372
373373 component . entryForm . patchValue ( { description : 'test' } ) ;
@@ -378,23 +378,23 @@ describe('DetailsFieldsComponent', () => {
378378 it ( 'should modify the start_date when start_hour has been modified' , ( ) => {
379379 const startDate = new Date ( mockCurrentDate ) ;
380380
381- component . entryToEdit = { ...entryToEdit , start_date : startDate } ;
381+ component . entryToEdit = { ...entryToEdit , start_date : startDate } ;
382382 fixture . componentInstance . ngOnChanges ( ) ;
383383
384384 const updatedStartDate = moment ( startDate ) . subtract ( 1 , 'hours' ) ;
385- const updatedStartHour = updatedStartDate . format ( 'HH:mm' ) ;
386- component . entryForm . patchValue ( { start_hour : updatedStartHour } ) ;
385+ const updatedStartHour = updatedStartDate . format ( 'HH:mm' ) ;
386+ component . entryForm . patchValue ( { start_hour : updatedStartHour } ) ;
387387
388388 const expectedStartDate = moment ( updatedStartDate ) . seconds ( 0 ) . millisecond ( 0 ) . toISOString ( ) ;
389389 expect ( component . dateToSubmit ( 'start_date' , 'start_hour' ) ) . toEqual ( expectedStartDate ) ;
390- } ) ;
390+ } ) ;
391391
392392 it ( 'should not modify the end_date when end_hour has not been modified' , ( ) => {
393393 const currentDate = moment ( ) . format ( 'YYYY-MM-DD' ) ;
394394 const endHour = moment ( ) . subtract ( 3 , 'hours' ) . format ( 'HH:mm:ss' ) ;
395395 const expectedEndDate = new Date ( `${ currentDate } T${ endHour . trim ( ) } ` ) ;
396396
397- component . entryToEdit = { ...entryToEdit , end_date : expectedEndDate } ;
397+ component . entryToEdit = { ...entryToEdit , end_date : expectedEndDate } ;
398398 fixture . componentInstance . ngOnChanges ( ) ;
399399
400400 component . entryForm . patchValue ( { description : 'test' } ) ;
@@ -405,16 +405,16 @@ describe('DetailsFieldsComponent', () => {
405405 it ( 'should modify the end_date when end_hour has been modified' , ( ) => {
406406 const endDate = new Date ( mockCurrentDate ) ;
407407
408- component . entryToEdit = { ...entryToEdit , end_date : endDate } ;
408+ component . entryToEdit = { ...entryToEdit , end_date : endDate } ;
409409 fixture . componentInstance . ngOnChanges ( ) ;
410410
411411 const updatedEndDate = moment ( endDate ) . subtract ( 1 , 'hours' ) ;
412- const updatedEndHour = updatedEndDate . format ( 'HH:mm' ) ;
413- component . entryForm . patchValue ( { end_hour : updatedEndHour } ) ;
412+ const updatedEndHour = updatedEndDate . format ( 'HH:mm' ) ;
413+ component . entryForm . patchValue ( { end_hour : updatedEndHour } ) ;
414414
415415 const expectedEndDate = moment ( updatedEndDate ) . seconds ( 0 ) . millisecond ( 0 ) . toISOString ( ) ;
416416 expect ( component . dateToSubmit ( 'end_date' , 'end_hour' ) ) . toEqual ( expectedEndDate ) ;
417- } ) ;
417+ } ) ;
418418
419419 it ( 'displays error message when the date selected is in the future' , ( ) => {
420420 spyOn ( toastrServiceStub , 'error' ) ;
@@ -451,8 +451,8 @@ describe('DetailsFieldsComponent', () => {
451451 it ( 'should emit projectSelected event' , ( ) => {
452452 spyOn ( component . projectSelected , 'emit' ) ;
453453 const item = {
454- id : 'id' ,
455- search_field : 'TimeTracker'
454+ id : 'id' ,
455+ search_field : 'TimeTracker'
456456 } ;
457457 component . onSelectedProject ( item ) ;
458458
@@ -495,13 +495,13 @@ describe('DetailsFieldsComponent', () => {
495495 } ) ;
496496
497497 it ( 'on the input with id #start_date we could get the id and max value' , ( ) => {
498- fixture . detectChanges ( ) ;
499- const expectedDate = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
500- const startDateInput : HTMLInputElement = fixture . debugElement .
501- nativeElement . querySelector ( `input[id="start_date"],input[max="${ component . getCurrentDate ( ) } "]` ) ;
498+ fixture . detectChanges ( ) ;
499+ const expectedDate = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
500+ const startDateInput : HTMLInputElement = fixture . debugElement .
501+ nativeElement . querySelector ( `input[id="start_date"],input[max="${ component . getCurrentDate ( ) } "]` ) ;
502502
503- expect ( startDateInput . id ) . toEqual ( 'start_date' ) ;
504- expect ( startDateInput . max ) . toEqual ( expectedDate ) ;
503+ expect ( startDateInput . id ) . toEqual ( 'start_date' ) ;
504+ expect ( startDateInput . max ) . toEqual ( expectedDate ) ;
505505 } ) ;
506506
507507 it ( 'on the input with id #end_date we could get the current Date ' , ( ) => {
0 commit comments