Skip to content

Commit

Permalink
Adding tests for hasInputError
Browse files Browse the repository at this point in the history
  • Loading branch information
thamara committed Jun 22, 2020
1 parent d4d1910 commit 3dcebfc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions __tests__/__renderer__/classes/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,27 @@ describe('Calendar class Tests', () => {
expect(calendar._getCalendarYear()).toBe(today.getFullYear());
});

describe('hasInputError(dayBegin, lunchBegin, lunchEnd, dayEnd)', () => {
test('Test scenarios where there is no error on the inputs', () => {
expect(calendar._hasInputError('00:00', '12:00', '13:00', '20:00')).not.toBeTruthy();
expect(calendar._hasInputError('00:00', '12:00', '13:00', '')).not.toBeTruthy();
expect(calendar._hasInputError('00:00', '12:00', '', '')).not.toBeTruthy();
expect(calendar._hasInputError('00:00', '', '', '')).not.toBeTruthy();
expect(calendar._hasInputError('', '', '', '')).not.toBeTruthy();
expect(calendar._hasInputError('00:00', '', '', '20:00')).not.toBeTruthy();
});

test('Test scenarios where there is error on the inputs', () => {
expect(calendar._hasInputError('23:00', '', '', '00:00')).toBeTruthy();
expect(calendar._hasInputError('', '23:00', '', '00:00')).toBeTruthy();
expect(calendar._hasInputError('', '', '23:00', '00:00')).toBeTruthy();
// TODO: Fix commented
// expect(calendar._hasInputError('not-valid-hour', '', '', 'not-valid-hour')).toBeTruthy();
//expect(calendar._hasInputError('00:00', '12:00', '', '20:00')).not.toBeTruthy();
//expect(calendar._hasInputError('00:00', '', '13:00', '20:00')).not.toBeTruthy();
});
});

describe('DayCalendar RefreshOnDayChange', () => {
test('DayCalendar refresh set correctly', () => {
// Calendar is set as if someone was looking at previous day
Expand Down

0 comments on commit 3dcebfc

Please sign in to comment.