@@ -262,19 +262,16 @@ describe('EntryFieldsComponent', () => {
262262 expect ( component . lastEntry ) . toBe ( state . entries . timeEntriesDataSource . data [ 1 ] ) ;
263263 } ) ) ;
264264
265- it ( 'When start_time is updated for a time entry. UpdateEntry and UpdateEntryRuning actions are dispatched' , ( ) => {
265+ it ( 'When start_time is updated for a time entry. UpdateTwoEntry action is dispatched' , ( ) => {
266266 component . activeEntry = entry ;
267267 component . setDataToUpdate ( entry ) ;
268- const lastEntry = state . entries . timeEntriesDataSource . data [ 1 ] ;
269268 const updatedTime = moment ( ) . subtract ( 4 , 'hours' ) . format ( 'HH:mm' ) ;
270- const lastStartHourEntryEnteredTest = new Date ( `${ lastDate } T${ updatedTime . trim ( ) } ` ) . toISOString ( ) ;
271269 component . entryForm . patchValue ( { start_hour : updatedTime } ) ;
272270 spyOn ( store , 'dispatch' ) ;
273271
274272 component . onUpdateStartHour ( ) ;
275273
276- expect ( store . dispatch ) . toHaveBeenCalledTimes ( 2 ) ;
277- expect ( store . dispatch ) . toHaveBeenCalledWith ( new UpdateEntry ( { id : lastEntry . id , end_date : lastStartHourEntryEnteredTest } ) ) ;
274+ expect ( store . dispatch ) . toHaveBeenCalledTimes ( 1 ) ;
278275 } ) ;
279276
280277 it ( 'when a technology is added, then dispatch UpdateActiveEntry' , ( ) => {
@@ -370,7 +367,7 @@ describe('EntryFieldsComponent', () => {
370367 expect ( store . dispatch ) . toHaveBeenCalledWith ( new LoadActiveEntry ( ) ) ;
371368 } ) ;
372369
373- it ( 'when entry has an end_date then nothing is dispatched ' , ( ) => {
370+ it ( 'when entry has an end_date then update time entry running and load entries ' , ( ) => {
374371 spyOn ( store , 'dispatch' ) ;
375372
376373 const actionSubject = TestBed . inject ( ActionsSubject ) as ActionsSubject ;
@@ -381,7 +378,7 @@ describe('EntryFieldsComponent', () => {
381378
382379 actionSubject . next ( action ) ;
383380
384- expect ( store . dispatch ) . toHaveBeenCalledTimes ( 0 ) ;
381+ expect ( store . dispatch ) . toHaveBeenCalledTimes ( 3 ) ;
385382 } ) ;
386383
387384 it ( 'activeEntry is populated using the payload of LOAD_ACTIVE_ENTRY_SUCCESS' , ( ) => {
0 commit comments