-
Notifications
You must be signed in to change notification settings - Fork 174
chore: Updating tests to the masking to ensure date formats are covered #3530
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3530 +/- ##
==========================================
+ Coverage 96.54% 96.58% +0.03%
==========================================
Files 805 805
Lines 23446 23455 +9
Branches 8165 7750 -415
==========================================
+ Hits 22637 22653 +16
+ Misses 802 795 -7
Partials 7 7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
}); | ||
}); | ||
describe('getValidValue', () => { | ||
mask.segments.forEach((segment, segmentIndex) => { |
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 is not the easiest code to read, but I couldn't think of a better way that encompasses a test case for each segment. It looks ugly here, but in the test breakdown it all makes sense
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.
I think overall the test logic here is too complex to be valuable and maintainable in the long term: we almost need tests for the tests... Instead I would suggest trying to create some real-world examples and using those, as that will be much easier to understand and maintain over time.
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.
(if I was adding new functionality, I would have no idea where to start within this test logic to add new tests)
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.
Thanks for the confirmation. Yea we might even need tests for the tests for the tests... I will do more like I've done below.
5c7ab39
to
e497786
Compare
Updating tests to the masking utils
This pull request adds more comprehensive tests for the useMask hook in the masked-input component. The new tests cover the following scenarios:
Date Masks
Time Masks
General Improvements
These changes ensure that the useMask hook can handle a wider range of date and time formats, and that the masking functionality is thoroughly tested across various use cases.
Related links, issue #, if available: n/a
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.