From 3dcebfcb46e457b3e4ed370fa5f620ee56083aa9 Mon Sep 17 00:00:00 2001 From: Thamara Andrade Date: Sun, 21 Jun 2020 23:03:21 -0300 Subject: [PATCH] Adding tests for hasInputError --- __tests__/__renderer__/classes/Calendar.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/__tests__/__renderer__/classes/Calendar.js b/__tests__/__renderer__/classes/Calendar.js index 15d625ede..a997775ad 100644 --- a/__tests__/__renderer__/classes/Calendar.js +++ b/__tests__/__renderer__/classes/Calendar.js @@ -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