Skip to content

Commit

Permalink
Support +447 and 07 for ukmobilephone validator
Browse files Browse the repository at this point in the history
Updates the ukmobilephone validator to support numbers starting with 07 or +447
  • Loading branch information
robertdeniszczyc2 committed Dec 12, 2024
1 parent 977f7bf commit 1914dc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controller/validation/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ module.exports = Validators = {
},

ukmobilephone(value) {
return value === '' || Validators.regex(value, /^(07)\d{9}$/);
return value === '' || Validators.regex(value, /^(?:\+447|07)\d{9}$/);
},

date(value) {
Expand Down
4 changes: 2 additions & 2 deletions test/controller/spec/validators.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ describe('Validators', () => {
describe('ukmobilephone', () => {
describe('invalid values', () => {
const inputs = [
'+447812123456',
'+4407812123456',
'+44(0)7812123456',
'447812123456',
Expand All @@ -420,7 +419,8 @@ describe('Validators', () => {
describe('valid values', () => {
const inputs = [
'',
'07812123456'
'07812123456',
'+447812123456'
];
inputs.forEach(i => {
it(testName(i), () => {
Expand Down

0 comments on commit 1914dc7

Please sign in to comment.