Skip to content

Commit e9abab6

Browse files
committed
fix: TT-226 solved PR comments
1 parent 2ef5fa1 commit e9abab6

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

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

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,35 @@ describe('DetailsFieldsComponent', () => {
577577
expect(foundActivity).toEqual(expectedActivity);
578578
});
579579

580-
it('should return false when the start time entry is not greater than the end time', () => {
581-
const result = component.isStartTimeEntryAfterEndedEntry();
580+
const datesParams = [
581+
{
582+
case: 'should return true when the start time entry is greater than the end time',
583+
entryDates: {
584+
start_date: '2021-04-21',
585+
end_date: '2021-04-21',
586+
start_hour: '20:00',
587+
end_hour: '08:00',
588+
},
589+
expected_result: true,
590+
},
591+
{
592+
case: 'should return false when the start time entry is not greater than the end time',
593+
entryDates: {
594+
start_date: '2021-04-21',
595+
end_date: '2021-04-21',
596+
start_hour: '19:00',
597+
end_hour: '20:00',
598+
},
599+
expected_result: false,
600+
},
601+
];
602+
datesParams.map((param) => {
603+
it(`${param.case}`, () => {
604+
component.entryForm.setValue({ ...formValues, ...param.entryDates });
605+
const result = component.isStartTimeEntryAfterEndedEntry();
582606

583-
expect(result).toBeFalse();
607+
expect(result).toBe(param.expected_result);
608+
});
584609
});
585610
/*
586611
TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component,

0 commit comments

Comments
 (0)