Skip to content

Commit

Permalink
test: add tests specifically for isLuhnValid
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed May 23, 2022
1 parent d9896ca commit 4098467
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4931,6 +4931,34 @@ describe('Validators', () => {
});
});

it('should validate luhn numbers', () => {
test({
validator: 'isLuhnValid',
valid: [
'0',
'5421',
'01234567897',
'0123456789012345678906',
'0123456789012345678901234567891',
'123456789012345678906',
'375556917985515',
'36050234196908',
'4716461583322103',
'4716-2210-5188-5662',
'4929 7226 5379 7141',
],
invalid: [
'',
'1',
'5422',
'foo',
'prefix6234917882863855',
'623491788middle2863855',
'6234917882863855suffix',
],
});
});

it('should validate credit cards', () => {
test({
validator: 'isCreditCard',
Expand Down

0 comments on commit 4098467

Please sign in to comment.