@@ -11,10 +11,11 @@ import { TechnologyState } from '../../shared/store/technology.reducers';
1111import { TimeEntriesSummaryComponent } from '../../time-clock/components/time-entries-summary/time-entries-summary.component' ;
1212import * as entryActions from '../../time-clock/store/entry.actions' ;
1313import { EntryState } from '../../time-clock/store/entry.reducer' ;
14- import { getTimeEntriesDataSource } from '../../time-clock/store/entry.selectors' ;
14+ import { getTimeEntriesDataSource , getActiveTimeEntry } from '../../time-clock/store/entry.selectors' ;
1515import { LoadActiveEntry } from './../../time-clock/store/entry.actions' ;
1616import { TimeEntriesComponent } from './time-entries.component' ;
17-
17+ import { ActionsSubject } from '@ngrx/store' ;
18+ import { EntryActionTypes } from './../../time-clock/store/entry.actions' ;
1819
1920describe ( 'TimeEntriesComponent' , ( ) => {
2021 type Merged = TechnologyState & ProjectState & EntryState ;
@@ -179,6 +180,27 @@ describe('TimeEntriesComponent', () => {
179180 expect ( component . entryId ) . toBe ( anEntryId ) ;
180181 } ) ;
181182
183+ it ( 'when trigger edit action and there is no active entry, active entry should be null' , ( ) => {
184+ state . active = null ;
185+ mockEntriesSelector = store . overrideSelector ( getActiveTimeEntry , state . active ) ;
186+
187+ const actionSubject = TestBed . inject ( ActionsSubject ) as ActionsSubject ;
188+ const action = {
189+ type : EntryActionTypes . UPDATE_ENTRY_SUCCESS ,
190+ payload : {
191+ project_id : 'project-id' ,
192+ start_date : '2010-05-05T10:04' ,
193+ description : 'description' ,
194+ technologies : [ ] ,
195+ uri : 'abc' ,
196+ } ,
197+ } ;
198+
199+ actionSubject . next ( action ) ;
200+
201+ expect ( component . activeTimeEntry ) . toBeNull ( ) ;
202+ } ) ;
203+
182204 it ( 'given a list of entries having an entry running when editing a different entry it cannot be marked as WIP ' , ( ) => {
183205 const anEntryId = '1' ;
184206 const anotherEntryId = '2' ;
0 commit comments