Skip to content

Commit 4098467

Browse files
committed
test: add tests specifically for isLuhnValid
1 parent d9896ca commit 4098467

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/validators.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4931,6 +4931,34 @@ describe('Validators', () => {
49314931
});
49324932
});
49334933

4934+
it('should validate luhn numbers', () => {
4935+
test({
4936+
validator: 'isLuhnValid',
4937+
valid: [
4938+
'0',
4939+
'5421',
4940+
'01234567897',
4941+
'0123456789012345678906',
4942+
'0123456789012345678901234567891',
4943+
'123456789012345678906',
4944+
'375556917985515',
4945+
'36050234196908',
4946+
'4716461583322103',
4947+
'4716-2210-5188-5662',
4948+
'4929 7226 5379 7141',
4949+
],
4950+
invalid: [
4951+
'',
4952+
'1',
4953+
'5422',
4954+
'foo',
4955+
'prefix6234917882863855',
4956+
'623491788middle2863855',
4957+
'6234917882863855suffix',
4958+
],
4959+
});
4960+
});
4961+
49344962
it('should validate credit cards', () => {
49354963
test({
49364964
validator: 'isCreditCard',

0 commit comments

Comments
 (0)