Skip to content

Commit cbf454c

Browse files
committed
fix: TT-117 creating new test
1 parent 95f3121 commit cbf454c

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/app/modules/shared/components/details-fields/details-fields.component.spec.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ describe('DetailsFieldsComponent', () => {
244244
},
245245
shouldRestartEntry: false
246246
};
247-
expect(component.shouldRestartEntry).toBeFalse();
247+
248248
expect(component.saveEntry.emit).toHaveBeenCalledWith(data);
249249
});
250250

@@ -300,6 +300,23 @@ describe('DetailsFieldsComponent', () => {
300300
fixture.componentInstance.ngOnChanges();
301301

302302
expect(component.goingToWorkOnThis).toBeFalse();
303+
expect(component.shouldRestartEntry).toBeFalse();
304+
});
305+
306+
it('when editing entry is running, shouldRestartEntry should be false', () => {
307+
component.entryToEdit = { ...entryToEdit, running: true };
308+
309+
fixture.componentInstance.ngOnChanges();
310+
311+
expect(component.goingToWorkOnThis).toBeTrue();
312+
expect(component.shouldRestartEntry).toBeFalse();
313+
});
314+
315+
it('when editing entry change to going to work on this shouldRestartEntry should be true', () => {
316+
component.onGoingToWorkOnThisChange({ currentTarget: { checked: true } });
317+
318+
expect(component.goingToWorkOnThis).toBeTrue();
319+
expect(component.shouldRestartEntry).toBeTrue();
303320
});
304321

305322
it('when submitting a entry that is currently running, the end date should not be sent ', () => {
@@ -322,7 +339,7 @@ describe('DetailsFieldsComponent', () => {
322339
},
323340
shouldRestartEntry: false
324341
};
325-
expect(component.shouldRestartEntry).toBeFalse();
342+
326343
expect(component.saveEntry.emit).toHaveBeenCalledWith(data);
327344
});
328345

0 commit comments

Comments
 (0)