Skip to content
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

feat: Add phone validator #118

Merged
merged 4 commits into from
Aug 30, 2024
Merged

feat: Add phone validator #118

merged 4 commits into from
Aug 30, 2024

Conversation

TSenter
Copy link
Contributor

@TSenter TSenter commented Aug 27, 2024

No description provided.

@TSenter TSenter added the enhancement New feature or request label Aug 27, 2024
@TSenter TSenter linked an issue Aug 28, 2024 that may be closed by this pull request
/** A phone number with a 1-4 digit line number */
export const lineNumberInput = /^(\d{1,4})$/;

/** A phone number with a 1-4 digit exchange code */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** A phone number with a 1-4 digit exchange code */
/** A phone number with a 1-3 digit exchange code */

packages/ember/src/validation/validators/phone.ts Outdated Show resolved Hide resolved
packages/ember/src/validation/validators/phone.ts Outdated Show resolved Hide resolved
packages/ember/src/validation/validators/phone.ts Outdated Show resolved Hide resolved
Comment on lines +78 to +82
assert.deepEqual(result, {
isValid: true,
isWarning: false,
message: undefined,
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we wrap this in a function to aid readability and general dryness?
assertValid(validator), assertInvalid(validator, message), assertWarning(validator, message)

I find myself breaking flow to read each of the options passed to deepEqual each time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I do that in a separate PR? That's a change I'd like to make in all the validator tests

@KeithClinard KeithClinard merged commit 89edeb4 into main Aug 30, 2024
10 checks passed
@KeithClinard KeithClinard deleted the senter-phone-validator branch August 30, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

Validator - Phone type
2 participants