File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
src/app/modules/time-clock/store Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,11 @@ describe('TimeEntryActionEffects', () => {
121121 it ( 'returns a LOAD_ACTIVE_ENTRY_SUCCESS when the entry that is running it is in the same day' , async ( ) => {
122122 actions$ = of ( { type : EntryActionTypes . LOAD_ACTIVE_ENTRY } ) ;
123123 const serviceSpy = spyOn ( service , 'loadActiveEntry' ) ;
124- serviceSpy . and . returnValue ( of ( entry ) ) ;
124+ const mockEntry = {
125+ ...entry ,
126+ start_date : new Date ( )
127+ } ;
128+ serviceSpy . and . returnValue ( of ( mockEntry ) ) ;
125129
126130 effects . loadActiveEntry$ . subscribe ( action => {
127131 expect ( action . type ) . toEqual ( EntryActionTypes . LOAD_ACTIVE_ENTRY_SUCCESS ) ;
@@ -355,8 +359,11 @@ describe('TimeEntryActionEffects', () => {
355359
356360 it ( 'should update last entry when UPDATE_CURRENT_OR_LAST_ENTRY is executed' , async ( ) => {
357361 actions$ = of ( { type : EntryActionTypes . UPDATE_CURRENT_OR_LAST_ENTRY , payload : entry } ) ;
358- spyOn ( service , 'loadEntries' ) . and . returnValue ( of ( [ entry , entry ] ) ) ;
359-
362+ const lastEntryMock : Entry = {
363+ ...entry ,
364+ end_date : moment ( entry . start_date ) . add ( 4 , 'h' ) . toDate ( ) ,
365+ } ;
366+ spyOn ( service , 'loadEntries' ) . and . returnValue ( of ( [ entry , lastEntryMock ] ) ) ;
360367 effects . updateCurrentOrLastEntry$ . subscribe ( action => {
361368 expect ( action . type ) . toEqual ( EntryActionTypes . UPDATE_ENTRY ) ;
362369 } ) ;
You can’t perform that action at this time.
0 commit comments