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
11 changes: 11 additions & 0 deletions src/modules/finance/iban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,17 @@ const iban: Iban = {
],
format: 'ILkk bbbn nncc cccc cccc ccc',
},
{
country: 'IR',
total: 26,
bban: [
{
type: 'n',
count: 22,
},
],
format: 'IRkk bbbb cccc cccc cccc cccc cc',
},
{
country: 'IT',
total: 27,
Expand Down
4 changes: 2 additions & 2 deletions test/modules/__snapshots__/finance.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ exports[`finance > 1337 > currencySymbol 1`] = `"$"`;

exports[`finance > 1337 > ethereumAddress 1`] = `"0x536a7b5fa28d2f9bb79ca46ea394bc4f9bb0af32"`;

exports[`finance > 1337 > iban > noArgs 1`] = `"FO2200532700604734"`;
exports[`finance > 1337 > iban > noArgs 1`] = `"FI1300552916047457"`;

exports[`finance > 1337 > iban > with formatted and countryCode option 1`] = `"DE04 0033 2713 1474 7007 41"`;

exports[`finance > 1337 > iban > with formatted option 1`] = `"FO22 0053 2700 6047 34"`;
exports[`finance > 1337 > iban > with formatted option 1`] = `"FI13 0055 2916 0474 57"`;

exports[`finance > 1337 > litecoinAddress 1`] = `"LhsjwgYJ7oC8ZrMNmqzLbhEubpcw"`;

Expand Down
25 changes: 25 additions & 0 deletions test/modules/finance-iban.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,31 @@ describe('finance_iban', () => {
`First two character should be AL, given is ${iban.substring(0, 2)}`
).toBe('AL');
});

it('IBAN for Iran is correct', () => {
const iban = faker.finance.iban({
formatted: false,
countryCode: 'IR',
});
const ibanFormated = prettyPrintIban(iban);

expect(iban).toSatisfy(isIBAN);

expect(
26,
`IR IBAN would be 26 chars length, given is ${iban.length}`
).toBe(iban.length);

expect(
32,
`IR formatted IBAN would be 32 chars length, given is ${ibanFormated.length}`
).toBe(ibanFormated.length);

expect(
iban.substring(0, 2),
`First two character should be IR, given is ${iban.substring(0, 2)}`
).toBe('IR');
});
});
}
);
Expand Down