Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/isIBAN.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const ibanRegexThroughCountryCode = {
IE: /^(IE[0-9]{2})[A-Z]{4}\d{14}$/,
IL: /^(IL[0-9]{2})\d{19}$/,
IQ: /^(IQ[0-9]{2})[A-Z]{4}\d{15}$/,
IR: /^(IR[0-9]{2})0\d{2}0\d{18}$/,
IR: /^(IR[0-9]{2})\d{22}$/,
IS: /^(IS[0-9]{2})\d{22}$/,
IT: /^(IT[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,
JO: /^(JO[0-9]{2})[A-Z]{4}\d{22}$/,
Expand Down
29 changes: 29 additions & 0 deletions test/validators/isIBAN.test.js
Copy link
Member

Choose a reason for hiding this comment

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

Please move this to the large validator file, where we already have the other isIBAN tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, so sorry didn't see it

done

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import test from '../testFunctions';

describe('isIBAN', () => {
it('should validate IBANs', () => {
test({
validator: 'isIBAN',
valid: [
'IR576406610070915600106898',
],
invalid: [
// Invalid format/checksum
'IR545049154806779008008299',

// Invalid structure
'IR5750491548067790080082',

// Country code not in whitelist when specified
// Empty/null values
'',
' ',

// Random invalid strings
'not an iban',
'1234567890',
'ABCD1234567890',
],
});
});
});
Loading