Skip to content

Commit

Permalink
fix: pl/pesel checksum error
Browse files Browse the repository at this point in the history
  • Loading branch information
koblas committed Jul 1, 2023
1 parent af44c7e commit fb99b1f
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 fb99b1f

Please sign in to comment.