-
Notifications
You must be signed in to change notification settings - Fork 249
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(authenticator): required phone number validator #4106
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,44 @@ void main() { | |
}, | ||
); | ||
|
||
testWidgets( | ||
'displays message when submitted with empty phone number if the field is required', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Does this test cover the issue that triggered this change? It's unclear how this test was untrue before the changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Line 149 would fail today on main as the phone number is currently never considered empty as there is always a dial code. |
||
(tester) async { | ||
await tester.pumpWidget( | ||
MockAuthenticatorApp( | ||
initialStep: AuthenticatorStep.signUp, | ||
signUpForm: SignUpForm.custom( | ||
fields: [ | ||
SignUpFormField.username(), | ||
SignUpFormField.phoneNumber(required: true), | ||
SignUpFormField.password(), | ||
], | ||
), | ||
), | ||
); | ||
await tester.pumpAndSettle(); | ||
|
||
final signUpPage = SignUpPage(tester: tester); | ||
|
||
await signUpPage.submitSignUp(); | ||
|
||
await tester.pumpAndSettle(); | ||
|
||
Finder findPhoneFieldError() => find.descendant( | ||
of: signUpPage.phoneField, | ||
matching: find.text('Phone Number field must not be blank.'), | ||
); | ||
|
||
expect(findPhoneFieldError(), findsOneWidget); | ||
|
||
await signUpPage.enterPhoneNumber('1235556789'); | ||
|
||
await signUpPage.submitSignUp(); | ||
|
||
expect(findPhoneFieldError(), findsNothing); | ||
}, | ||
); | ||
|
||
testWidgets( | ||
'displays message when submitted with invalid birth date', | ||
(tester) async { | ||
|
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.
What is this meant to match? Should it not be
^[0-9]+$
?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.
or
^\d+$
?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.
Yes, the
\
should not have been removed. Updated.