@@ -99,7 +99,12 @@ describe('EntryFieldsComponent', () => {
9999 description : 'description for active entry' ,
100100 uri : 'abc' ,
101101 start_date : moment ( mockDate ) . format ( DATE_FORMAT_YEAR ) ,
102- start_hour : moment ( mockDate ) . format ( 'HH:mm' ) ,
102+ start_hour : moment ( mockDate ) . format ( 'HH:mm' )
103+ } ;
104+
105+ const mockEntryOverlap = {
106+ ...entry ,
107+ update_last_entry_if_overlap : true
103108 } ;
104109
105110 beforeEach ( waitForAsync ( ( ) => {
@@ -252,19 +257,22 @@ describe('EntryFieldsComponent', () => {
252257 } ) ;
253258
254259 it ( 'when a start hour is updated, then dispatch UpdateActiveEntry' , ( ) => {
260+ component . newData = mockEntryOverlap ;
255261 component . activeEntry = entry ;
256262 component . setDataToUpdate ( entry ) ;
257263 const updatedTime = moment ( mockDate ) . format ( 'HH:mm' ) ;
258- // this.newData.update_last_entry_if_overlap = true;
264+
259265 component . entryForm . patchValue ( { start_hour : updatedTime } ) ;
260266 spyOn ( store , 'dispatch' ) ;
261267
262268 component . onUpdateStartHour ( ) ;
269+
263270 expect ( store . dispatch ) . toHaveBeenCalled ( ) ;
264271 expect ( component . showTimeInbuttons ) . toEqual ( false ) ;
265272 } ) ;
266273
267274 it ( 'When start_time is updated, component.last_entry is equal to time entry in the position 1' , waitForAsync ( ( ) => {
275+ component . newData = mockEntryOverlap ;
268276 component . activeEntry = entry ;
269277 component . setDataToUpdate ( entry ) ;
270278 const updatedTime = moment ( mockDate ) . format ( 'HH:mm' ) ;
@@ -276,6 +284,7 @@ describe('EntryFieldsComponent', () => {
276284 } ) ) ;
277285
278286 it ( 'When start_time is updated for a time entry. UpdateCurrentOrLastEntry action is dispatched' , ( ) => {
287+ component . newData = mockEntryOverlap ;
279288 component . activeEntry = entry ;
280289 component . setDataToUpdate ( entry ) ;
281290 const updatedTime = moment ( mockDate ) . subtract ( 4 , 'hours' ) . format ( 'HH:mm' ) ;
0 commit comments