From da9692fce6fc5208f1c24c2c7cc9d835590deeca Mon Sep 17 00:00:00 2001 From: ThatcherK Date: Thu, 8 Jun 2023 23:36:35 +0300 Subject: [PATCH 1/2] Add regex check to cater for existing organisation prefixes --- services/rulesValidator.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/services/rulesValidator.js b/services/rulesValidator.js index 82c197c..7ea4b38 100644 --- a/services/rulesValidator.js +++ b/services/rulesValidator.js @@ -146,12 +146,13 @@ class Rules { ); } if (oneCase.idCondition === 'NOT_EXISTING_ORG_ID_PREFIX') { - this.idCondition = this.pathMatchesText.every( - (pathText) => - !Array.from(idSets['ORG-ID']).some((orgId) => - pathText.startsWith(`${orgId}-`) - ) - ); + this.idCondition = + this.pathMatchesText.every( + (pathText) => + !Array.from(idSets['ORG-ID']).some((orgId) => + pathText.startsWith(`${orgId}-`) + ) + ) || this.regexNoMatches(oneCase); } } } From ff0496ed7d36e67a8b300c5cfff442a874017e8e Mon Sep 17 00:00:00 2001 From: ThatcherK Date: Fri, 9 Jun 2023 00:39:11 +0300 Subject: [PATCH 2/2] Update tests --- .../test-files/X.X.13_act_id_existing_pre_good.xml | 3 +++ ruleset-unit-tests/orgIdCheck/test.js | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 ruleset-unit-tests/orgIdCheck/test-files/X.X.13_act_id_existing_pre_good.xml diff --git a/ruleset-unit-tests/orgIdCheck/test-files/X.X.13_act_id_existing_pre_good.xml b/ruleset-unit-tests/orgIdCheck/test-files/X.X.13_act_id_existing_pre_good.xml new file mode 100644 index 0000000..5c3f719 --- /dev/null +++ b/ruleset-unit-tests/orgIdCheck/test-files/X.X.13_act_id_existing_pre_good.xml @@ -0,0 +1,3 @@ + + US-EIN-941655673-1 + diff --git a/ruleset-unit-tests/orgIdCheck/test.js b/ruleset-unit-tests/orgIdCheck/test.js index c2b03e9..251475d 100644 --- a/ruleset-unit-tests/orgIdCheck/test.js +++ b/ruleset-unit-tests/orgIdCheck/test.js @@ -54,6 +54,11 @@ const testMap = [ { rule: 'X.X.13_act_id.json', file: 'X.X.13_act_id_existing_pre.xml', + expectedResult: false, + }, + { + rule: 'X.X.13_act_id.json', + file: 'X.X.13_act_id_existing_pre_good.xml', expectedResult: true, }, {