diff --git a/lib/main/general-validators.ts b/lib/main/general-validators.ts index 42fa6ea..ac8835e 100644 --- a/lib/main/general-validators.ts +++ b/lib/main/general-validators.ts @@ -220,7 +220,7 @@ export const isLanNumberValidator = (value: string, country?: string): boolean = US: /^[A-Za-z0-9]{9,30}$/, UY: /^[0-9]{7,14}$/, } - const defaultRule = /^[A-Za-z0-9]{1,22}$/ + const defaultRule = /^[A-Za-z0-9]{1,30}$/ return !!value.replace(/ /g, '').match(lanCountriesRules[country] ? lanCountriesRules[country] : defaultRule) } /** diff --git a/package-lock.json b/package-lock.json index 15e4302..d112492 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@currency-one/validators", - "version": "1.1.24", + "version": "1.1.26", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@currency-one/validators", - "version": "1.1.24", + "version": "1.1.26", "license": "MIT", "devDependencies": { "@babel/cli": "^7.12.13", diff --git a/package.json b/package.json index 19ab20d..660430a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@currency-one/validators", - "version": "1.1.24", + "version": "1.1.26", "description": "Typescript collection of validators and regexp patterns", "main": "./index.js", "types": "./index.d.ts", diff --git a/test/general-validators.spec.ts b/test/general-validators.spec.ts index 75a433e..603c9ac 100644 --- a/test/general-validators.spec.ts +++ b/test/general-validators.spec.ts @@ -285,8 +285,8 @@ describe('Validators', () => { { country: 'SG', min: 1, max: 14 }, { country: 'TW', min: 1, max: 22 }, { country: 'US', min: 9, max: 30 }, - { country: 'OTHER', min: 1, max: 22 }, - { country: undefined, min: 1, max: 22 }, + { country: 'OTHER', min: 1, max: 30 }, + { country: undefined, min: 1, max: 30 }, ].forEach(({ country, min, max }) => describe(`isLanNumberValidator() validation behaviour for ${country} country code`, () => { it('should return true for valid lan number', () => { @@ -336,12 +336,6 @@ describe('Validators', () => { expect(isLanNumberValidator(`ZZZ${rawNumber}`, 'CN')).toBeFalsy() expect(isLanNumberValidator(`111${rawNumber}`, 'CN')).toBeFalsy() }) - - it('should not allow prefixes for other countries', async () => { - expect(isLanNumberValidator(`OSA${rawNumber}`, 'XX')).toBeFalsy() - expect(isLanNumberValidator(`NRA${rawNumber}`, 'XX')).toBeFalsy() - expect(isLanNumberValidator(`FTN${rawNumber}`, 'XX')).toBeFalsy() - }) }) it('should isRoutingCodeValidator() validate value correctly', () => {