Skip to content

fix: validate CNP unique county code - #26

Merged
kislakiruben merged 1 commit into
kislakiruben:masterfrom
alextkd:fix-cnp-county-code-70
Jun 24, 2026
Merged

fix: validate CNP unique county code#26
kislakiruben merged 1 commit into
kislakiruben:masterfrom
alextkd:fix-cnp-county-code-70

Conversation

@alextkd

@alextkd alextkd commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Fixed the issue that I just reported: #25

Copilot AI review requested due to automatic review settings June 24, 2026 11:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes CNP validation regression (Issue #25) by recognizing the “unique county code” (70) and by correctly resolving two-digit county codes with leading zeros (e.g. "09") against the existing numeric-keyed county list.

Changes:

  • Added county code 70 (“Cod unic”) to the county list.
  • Updated county parsing/validation to normalize county codes for lookup (supporting "09"9).
  • Added regression tests covering 70 CNP validation and "09" county parsing/validation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
test/Parser.test.js Adds a regression test ensuring a CNP containing county code 70 validates successfully.
test/countyParser.test.js Adds tests for parsing/validating two-digit county codes ("09") and the unique county code ("70").
src/countyParser.js Implements normalization-based lookup to support two-digit county codes and 70.
src/countyList.js Adds county entry for code 70 (“Cod unic”).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/countyParser.js
Comment on lines +3 to +7
const normalizeCountyCode = (countyCode) => {
const normalized = parseInt(countyCode, 10);

return Number.isNaN(normalized) ? countyCode : String(normalized);
};
Comment thread test/countyParser.test.js
Comment on lines +64 to +66
it(`should return 'true' if county is the unique registration code`, () => {
expect(countyValidator("70")).to.be.true;
});

@kislakiruben kislakiruben left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@kislakiruben
kislakiruben merged commit 30f1454 into kislakiruben:master Jun 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants