-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #4317: Fix Enzyme Test file in exclude_times_test.js and migrate it to use @testing-library/react #4318
Fix #4317: Fix Enzyme Test file in exclude_times_test.js and migrate it to use @testing-library/react #4318
Conversation
In the exclude_times_test.js file, the following modifications were made to improve the test case: 1. Added the 'open' prop to the <DatePicker /> component to ensure that it is open and its children can be tested. 2. Corrected the call to 'setTime' by providing the correct parameter format, { hour: x, minute: x }, instead of { hours: x, minutes: x }. 3. Replaced the assertion using '.not.toBeNull()' with '.toHaveLength(4)' when using '.find()'. This change makes the assertion more specific and reliable, ensuring that the test case passes only when it should. These updates enhance the accuracy and reliability of the test case in the exclude_times_test.js file. Closes Hacker0x01#4317
This commit updates the test case in exclude_times_test.js from using Enzyme to using @testing-library/react as requested by @martijnrusschen on [the issue Hacker0x01#4317](Hacker0x01#4317 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ This pull request was sent to the PullRequest network.
@balajis-qb you can click here to see the review status or cancel the code review job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PullRequest Breakdown
Reviewable lines of change
+ 14
- 10
100% JavaScript (tests)
Type of change
Fix - These changes are likely to be fixing a bug or issue.
Codecov Report
@@ Coverage Diff @@
## main #4318 +/- ##
==========================================
+ Coverage 96.54% 96.63% +0.08%
==========================================
Files 27 27
Lines 2374 2374
Branches 966 966
==========================================
+ Hits 2292 2294 +2
+ Misses 82 80 -2 |
Nice that was quick! looking great :) We have more usage of Enzyme, if you're up feel free to remove those as well. We need to remove Enzyme before we can safely migrate to the React 18 render methods. |
More info can be found here: #4300 |
Closes #4317
Summary
This PR addresses the issues in the test file
exclude_times_test.js
and also migrated the test cases to use@testing-library/react
instead ofenzyme
as requested by @martijnrusschenChanges Made
setTime
call<DatePicker />
component to test it, by passing theopen
prop.toHaveLength(4)
instead of using.not.toBeNull
@testing-library/react