-
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 #4334: Improved Test Cases Readability and Maintainability #4335
Fix #4334: Improved Test Cases Readability and Maintainability #4335
Conversation
In this commit, I've mad the following enhancements to the code: 1. Split the test-cases and move the test-case for checking the aria-disabled attribute to a separate it block. 2. Changed the use of the magic number 4 to the length of the input array excludeTimes for better flexibility and maintainability. Closes Hacker0x01#4334
In this commit, I've made the following enhancements to the code: 1. Replaced the magic value 17 with meaning constant for clarity. 2. Instead of directly checking the disabledTimeItems.length to be 2, make sure whether it's really the value we assigned (17 or 5pm). 3. Split the test-cases and move the test-case for checking the aria-disabled attribute to a separate it block. Closes Hacker0x01#4334
In this commit, I've made the following enhancements to the code: 1. Change the test case of finding the disabled time units count to the finding the enabled time units as the module involves on the existence of the includeTimes 2. Moved the test case to find the enabled time units through aria-disabled attribute to the separate it block 3. Replaced the magic value 45 with the actual computation which resolves to the magic value, to make it more maintainable and readable Closes Hacker0x01#4334
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
+ 94
- 27
100% JavaScript (tests)
Type of change
Fix - These changes are likely to be fixing a bug or issue.
Codecov Report
@@ Coverage Diff @@
## main #4335 +/- ##
=======================================
Coverage 96.63% 96.63%
=======================================
Files 27 27
Lines 2375 2375
Branches 953 953
=======================================
Hits 2295 2295
Misses 80 80 |
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.
Closes: #4334
Summary
I have made changes to improve the maintainability of certain test cases mentioned in the issue and removed magic numbers and refactored it a bit. This enhancement aims to make the core more readable and maintainable.
Motivation and Benefits
Improving test cases maintainability and removing magic numbers helps in the following ways:
Files Updated
test/filter_times_test.test.js
test/filter_times_test.test.js
test/exclude_times_test.test.js
Changes Made