-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Update validation schemas #603
Conversation
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.
@mira-kine Good start! Why isn't utils password validation schema being used here? And please add tests. Let us know if you would like any help.
Here's some ideas for test cases:
test123!
Testing!
Test123!
Test1234
12345678
7væVPj¼±mó5÷ÙÞW
Xin chào 1 bạn!
…ema for password and kept only validation for presence of pw
@paulespinosa the utils validation schemas is not shared across the components because we are validating differently here. In SignUp, we are using Formik + Yup to check that a user inputs a valid password before it is entered into the db, but for SignIn, we are only validating that there is a password at all. We had made this change after I made my PR, so I forgot to update it. Good catch - the PR should be updated with these changes now. I also updated the PR with the regex changes. Will be pushing up tests on SignUpForm special characters next. |
@mira-kine Got it, makes sense. Thank you! The changes look good so far. |
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.
Hey @mira-kine,
Thanks for the changes. The code changes look great, but the test cases are failing and I have some comments on the docs.
I made some suggestions that should help fix the test cases but I have a few more observations:
- Running the test cases gives this warning:
Warning: An update to PasswordValidation inside a test was not wrapped in act(...).
When testing, code that causes React state updates should be wrapped into act(...):
act(() => {
/* fire events that update state */
});
/* assert on the output */
I was able to dismiss it by wrapping the render and fireEvent calls in the act
block. I'm not sure if there is a more elegant solution.
SignInForm.should display error text
test case is failing because the login form no longer contains thepassword must contain
message. We removed that message in this PR, so you can remove that check.- I couldn't get the
7væVPj¼±mó5÷ÙÞW
test case to pass, even though this validation passes in the browser. I suspect there is an issue with the testing code, but I couldn't find it. Maybe @erikguntner might see the issue if you can't sort it out.
… test from SignIn
Closes #595
What changes did you make?
SignInForm
with special characters regex inPasswordValidationSchema
Testing done for these changes