Skip to content

Commit b6a3fa4

Browse files
authored
test: TT-306 test correction in TimeEntryActionEffects (#712)
* test: TT-306 test correction in TimeEntryActionEffects * test: TT-306 remove console.log
1 parent 7ec1de2 commit b6a3fa4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/app/modules/time-clock/store/entry.effects.spec.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)