Skip to content

Commit

Permalink
Resolved merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus committed Oct 30, 2021
1 parent 12c8430 commit 7f3e537
Show file tree
Hide file tree
Showing 8 changed files with 251 additions and 13 deletions.
28 changes: 28 additions & 0 deletions test/validators/isFQDN.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,22 @@ describe('isFQDN', () => {
'example.0',
'192.168.0.9999',
'192.168.0',
'domain.co\u00A0m',
'domain.co\u1680m',
'domain.co\u2006m',
'domain.co\u2028m',
'domain.co\u2029m',
'domain.co\u202Fm',
'domain.co\u205Fm',
'domain.co\u3000m',
'domain.com\uDC00',
'domain.co\uEFFFm',
'domain.co\uFDDAm',
'domain.co\uFFF4m',
],
});
});

it('should validate FQDN with trailing dot option', () => {
test({
validator: 'isFQDN',
Expand All @@ -40,6 +53,7 @@ describe('isFQDN', () => {
],
});
});

it('should invalidate FQDN when not require_tld', () => {
test({
validator: 'isFQDN',
Expand All @@ -53,6 +67,7 @@ describe('isFQDN', () => {
],
});
});

it('should validate FQDN when not require_tld but allow_numeric_tld', () => {
test({
validator: 'isFQDN',
Expand All @@ -66,4 +81,17 @@ describe('isFQDN', () => {
],
});
});

it('should validate FQDN with wildcard option', () => {
test({
validator: 'isFQDN',
args: [
{ allow_wildcard: true },
],
valid: [
'*.example.com',
'*.shop.example.com',
],
});
});
});
21 changes: 21 additions & 0 deletions test/validators/isIdentityCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@ import { test } from './testUtils';
describe('isIdentityCard', () => {
it('should validate identity cards', () => {
const fixtures = [
{
locale: 'LK',
valid: [
'722222222v',
'722222222V',
'993151225x',
'993151225X',
'188888388x',
'935632124V',
'199931512253',
'200023125632',
],
invalid: [
'023125648V',
'023345621v',
'021354211X',
'055321231x',
'02135465462',
'199931512253X',
],
},
{
locale: 'PL',
valid: [
Expand Down
40 changes: 40 additions & 0 deletions test/validators/isLicensePlate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('isLicensePlate', () => {
'ABC-1-EF',
],
});

test({
validator: 'isLicensePlate',
args: ['de-LI'],
Expand All @@ -34,6 +35,7 @@ describe('isLicensePlate', () => {
'FL -1',
],
});

test({
validator: 'isLicensePlate',
args: ['de-DE'],
Expand Down Expand Up @@ -69,6 +71,7 @@ describe('isLicensePlate', () => {
'FS AB 1234 A',
],
});

test({
validator: 'isLicensePlate',
args: ['sq-AL'],
Expand All @@ -82,6 +85,7 @@ describe('isLicensePlate', () => {
'AAA 00 AAA',
],
});

test({
validator: 'isLicensePlate',
args: ['cs-CZ'],
Expand Down Expand Up @@ -129,6 +133,7 @@ describe('isLicensePlate', () => {
'AB123DC',
],
});

test({
validator: 'isLicensePlate',
args: ['any'],
Expand All @@ -142,6 +147,7 @@ describe('isLicensePlate', () => {
'FS AB 1234 A',
],
});

test({
validator: 'isLicensePlate',
args: ['asdfasdf'],
Expand All @@ -152,5 +158,39 @@ describe('isLicensePlate', () => {
'FS AB 1234 A',
],
});

test({
validator: 'isLicensePlate',
args: ['fi-FI'],
valid: [
'ABC-123',
'ABC 123',
'ABC123',
'A100',
'A 100',
'A-100',
'C10001',
'C 10001',
'C-10001',
'123-ABC',
'123 ABC',
'123ABC',
'123-A',
'123 A',
'123A',
'199AA',
'199 AA',
'199-AA',
],
invalid: [
' ',
'A-1',
'A1A-100',
'1-A-2',
'C1234567',
'A B C 1 2 3',
'abc-123',
],
});
});
});
101 changes: 89 additions & 12 deletions test/validators/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,19 +542,28 @@ describe('isMobilePhone', () => {
{
locale: 'zh-CN',
valid: [
'15323456787',
'13523333233',
'13898728332',
'13838389438',
'14899230918',
'14999230918',
'15323456787',
'15052052020',
'16237108167',
'008616238234822',
'+8616238234822',
'16565600001',
'17269427292',
'17469427292',
'18199617480',
'19151751717',
'19651751717',
'+8613238234822',
'+8613487234567',
'+8617823492338',
'+8617823492338',
'16637108167',
'+8616637108167',
'+8616637108167',
'+8616712341234',
'008618812341234',
'008618812341234',
'+8619912341234',
'+8619812341234',
'+8619712341234',
Expand All @@ -563,17 +572,25 @@ describe('isMobilePhone', () => {
'+8619312341234',
'+8619212341234',
'+8619112341234',
'17269427292',
'16565600001',
'+8617269427292',
'008618812341234',
'008618812341234',
'008617269427292',
'16238234822',
'008616238234822',
'+8616238234822',
// Reserve number segments in the future.
'92138389438',
'+8692138389438',
'008692138389438',
'98199649964',
'+8698099649964',
'008698099649964',
],
invalid: [
'12345',
'',
'12038389438',
'12838389438',
'013838389438',
'+86-13838389438',
'+08613811211114',
'+008613811211114',
'08613811211114',
Expand Down Expand Up @@ -1199,14 +1216,13 @@ describe('isMobilePhone', () => {
'0786642116',
'078 7642116',
'078-7642116',

'0749994567',
],
invalid: [
'9912349956789',
'12345',
'1678123456',
'0731234567',
'0749994567',
'0797878674',
],
},
Expand Down Expand Up @@ -1456,6 +1472,34 @@ describe('isMobilePhone', () => {
'01234567',
],
},
{
locale: 'es-CU',
valid: [
'+5351234567',
'005353216547',
'51234567',
'53214567',
],
invalid: [
'1234',
'+5341234567',
'0041234567',
'41234567',
'11234567',
'21234567',
'31234567',
'60303456',
'71234567',
'81234567',
'91234567',
'+5343216547',
'+5332165498',
'+53121234567',
'',
'abc',
'+535123457',
],
},
{
locale: 'es-DO',
valid: [
Expand Down Expand Up @@ -2386,6 +2430,39 @@ describe('isMobilePhone', () => {
'NotANumber',
],
},
{
locale: 'en-PK',
valid: [
'+923412877421',
'+923001234567',
'00923001234567',
'923001234567',
'03001234567',
],
invalid: [
'+3001234567',
'+933001234567',
'+924001234567',
'+92300123456720',
'030012345672',
'30012345673',
'0030012345673',
'3001234567',
],
},
{
locale: 'hu-HU',
valid: [
'06301234567',
'+36201234567',
'06701234567',
],
invalid: [
'1234',
'06211234567',
'+3620123456',
],
},
];

let allValid = [];
Expand Down
2 changes: 1 addition & 1 deletion test/validators/isPassportNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ describe('isPassportNumber', () => {

test({
validator: 'isPassportNumber',
args: ['PO'],
args: ['PL'],
valid: [
'ZS 0000177',
'AN 3000011',
Expand Down
14 changes: 14 additions & 0 deletions test/validators/isPostalCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,20 @@ describe('isPostalCode', () => {
'ab1234',
],
},
{
locale: 'LK',
valid: [
'11500',
'22200',
'10370',
'43000',
],
invalid: [
'1234',
'789389',
'982',
],
},
];

let allValid = [];
Expand Down
25 changes: 25 additions & 0 deletions test/validators/isURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,29 @@ describe('isURL', () => {
],
});
});

it('should validate URLs with column and no port', () => {
test({
validator: 'isURL',
valid: [
'http://example.com:',
'ftp://example.com:',
],
invalid: [
'https://example.com:abc',
],
});
});

it('should validate sftp protocol URL containing column and no port', () => {
test({
validator: 'isURL',
args: [{
protocols: ['sftp'],
}],
valid: [
'sftp://user:[email protected]:/incoming/things.csv',
],
});
});
});
Loading

0 comments on commit 7f3e537

Please sign in to comment.