Skip to content

Commit

Permalink
Merge pull request #65 from koblas/pl_pesel
Browse files Browse the repository at this point in the history
fix: pl/pesel checksum error
  • Loading branch information
koblas authored Jul 1, 2023
2 parents 2d44cf7 + fb99b1f commit 9f876e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/pl/pesel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ describe('pl/pesel', () => {
expect(result).toEqual('44051401359');
});

it('validate:44051401359', () => {
test.each(['09222509560', '44051401359'])('validate:%s', value => {
const result = validate(value);

expect(result.isValid).toEqual(true);
});

it('cvalidate:44051401359', () => {
const result = validate('44051401359');

expect(result.isValid && result.compact).toEqual('44051401359');
Expand Down
2 changes: 1 addition & 1 deletion src/pl/pesel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const impl: Validator = {
modulus: 10,
});

if (String(10 - sum) !== check) {
if (String((10 - sum) % 10) !== check) {
return { isValid: false, error: new exceptions.InvalidChecksum() };
}

Expand Down

0 comments on commit 9f876e2

Please sign in to comment.