From 6ad732af6b1ee09909c2805029fa4a429c91c597 Mon Sep 17 00:00:00 2001 From: Jayesh Mangwani Date: Tue, 10 Oct 2023 15:28:13 +0530 Subject: [PATCH 1/4] =?UTF-8?q?updated=20regex=20range=20from=20=C3=A0-?= =?UTF-8?q?=C3=BF=20to=20\p{Ll}=20for=20checking=20the=20lowercase=20lette?= =?UTF-8?q?rs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CONST.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index 23957827d140..dd03f22efdcf 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1264,7 +1264,7 @@ const CONST = { CARD_NUMBER: /^[0-9]{15,16}$/, CARD_SECURITY_CODE: /^[0-9]{3,4}$/, CARD_EXPIRATION_DATE: /^(0[1-9]|1[0-2])([^0-9])?([0-9]{4}|([0-9]{2}))$/, - ROOM_NAME: /^#[a-z0-9à-ÿ-]{1,80}$/, + ROOM_NAME: /^#[\p{Ll}0-9-]{1,80}$/u, // eslint-disable-next-line max-len, no-misleading-character-class EMOJIS: /[\p{Extended_Pictographic}](\u200D[\p{Extended_Pictographic}]|[\u{1F3FB}-\u{1F3FF}]|[\u{E0020}-\u{E007F}]|\uFE0F|\u20E3)*|[\u{1F1E6}-\u{1F1FF}]{2}|[#*0-9]\uFE0F?\u20E3/gu, From f1e62dfd87ebdb8b61daba655f810d73c920b10a Mon Sep 17 00:00:00 2001 From: Jayesh Mangwani Date: Tue, 10 Oct 2023 15:52:03 +0530 Subject: [PATCH 2/4] added 2 tests for ROOM_NAME validation --- tests/unit/ValidationUtilsTest.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/ValidationUtilsTest.js b/tests/unit/ValidationUtilsTest.js index 003e0ab75afe..90b6cc512fe3 100644 --- a/tests/unit/ValidationUtilsTest.js +++ b/tests/unit/ValidationUtilsTest.js @@ -253,8 +253,18 @@ describe('ValidationUtils', () => { test('room name with spanish Accented letters and dashes', () => { expect(ValidationUtils.isValidRoomName('#sala-de-opinión')).toBe(true); }); + + test('room name with division sign (÷)', () => { + expect(ValidationUtils.isValidRoomName('#room-name-with-÷-sign')).toBe(false); + }); + + test('room name with Greek alphabet and Cyrillic alphabets', () => { + expect(ValidationUtils.isValidRoomName('#σοβαρός-серьезный')).toBe(true); + }); + }); + describe('isValidWebsite', () => { test('Valid URLs with https protocol', () => { expect(ValidationUtils.isValidWebsite('https://www.expensify.com')).toBe(true); From ee47d6b3181ba0855a52bd4a3c7d3ad8b0618321 Mon Sep 17 00:00:00 2001 From: Jayesh Mangwani Date: Tue, 10 Oct 2023 16:05:50 +0530 Subject: [PATCH 3/4] removed extra line --- tests/unit/ValidationUtilsTest.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/ValidationUtilsTest.js b/tests/unit/ValidationUtilsTest.js index 90b6cc512fe3..b7afa224a6c3 100644 --- a/tests/unit/ValidationUtilsTest.js +++ b/tests/unit/ValidationUtilsTest.js @@ -264,7 +264,6 @@ describe('ValidationUtils', () => { }); - describe('isValidWebsite', () => { test('Valid URLs with https protocol', () => { expect(ValidationUtils.isValidWebsite('https://www.expensify.com')).toBe(true); From aeca58bb31c90d0932dde47a8d7b8549e3b25c2d Mon Sep 17 00:00:00 2001 From: Jayesh Mangwani Date: Tue, 10 Oct 2023 16:17:55 +0530 Subject: [PATCH 4/4] prettified code --- tests/unit/ValidationUtilsTest.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/unit/ValidationUtilsTest.js b/tests/unit/ValidationUtilsTest.js index b7afa224a6c3..a9e0b1b61128 100644 --- a/tests/unit/ValidationUtilsTest.js +++ b/tests/unit/ValidationUtilsTest.js @@ -257,11 +257,10 @@ describe('ValidationUtils', () => { test('room name with division sign (÷)', () => { expect(ValidationUtils.isValidRoomName('#room-name-with-÷-sign')).toBe(false); }); - - test('room name with Greek alphabet and Cyrillic alphabets', () => { + + test('room name with Greek alphabets and Cyrillic alphabets', () => { expect(ValidationUtils.isValidRoomName('#σοβαρός-серьезный')).toBe(true); }); - }); describe('isValidWebsite', () => {