Problem
In the exclude_times_test.test.js file, we have encountered an issue when using Enzyme's .find() method in conjunction with mount() to render a <DatePicker /> component and querying elements by class. The .find() method is returning an empty wrapper even when the specified class does not exist, which is leading to inconsistencies in our test results and making it challenging to determine the validity of our test cases.

In the above screenshot, the test case should fail, as the <DatePicker /> is not opened or inline, it won't render any date or time, hence the test case would fail obviously. But as we're expecting expect(datePicker.find('xxx')).not.toBeNull() the test case is getting ignored.
So, in this file, I found 2 issues
<DatePicker /> is not opened, hence the test case fails
- Using
.not.toBeNull instead of checking specific assertion like length check
I also found one another important bug, that is related to the use of setTime helper while setting excludeTimes prop

If you notice the above screenshot, we're passing invalid argument to the setTime helper. For example, instead of hour, we are passing hours and instead of minute we're passing minutes.
Proposed Solution
- Fix the
setTime call
- Open the
<DatePicker /> component to test it, by passing the open prop
- Use .
toHaveLength(4) instead of using .not.toBeNull
Problem
In the
exclude_times_test.test.jsfile, we have encountered an issue when using Enzyme's.find()method in conjunction withmount()to render a<DatePicker />component and querying elements by class. The.find()method is returning an empty wrapper even when the specified class does not exist, which is leading to inconsistencies in our test results and making it challenging to determine the validity of our test cases.In the above screenshot, the test case should fail, as the
<DatePicker />is not opened or inline, it won't render any date or time, hence the test case would fail obviously. But as we're expectingexpect(datePicker.find('xxx')).not.toBeNull()the test case is getting ignored.So, in this file, I found 2 issues
<DatePicker />is not opened, hence the test case fails.not.toBeNullinstead of checking specific assertion like length checkI also found one another important bug, that is related to the use of

setTimehelper while settingexcludeTimespropIf you notice the above screenshot, we're passing invalid argument to the
setTimehelper. For example, instead ofhour, we are passinghoursand instead ofminutewe're passingminutes.Proposed Solution
setTimecall<DatePicker />component to test it, by passing theopenproptoHaveLength(4)instead of using.not.toBeNull