Skip to content

Commit

Permalink
fix(finance): update iso-3166-1 country codes for IBAN/BIC (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmenant committed Mar 21, 2022
1 parent af3f99e commit 6050d7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
19 changes: 1 addition & 18 deletions src/iban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1147,15 +1147,13 @@ export = {
},
],
iso3166: [
'AC',
'AD',
'AE',
'AF',
'AG',
'AI',
'AL',
'AM',
'AN',
'AO',
'AQ',
'AR',
Expand All @@ -1182,15 +1180,13 @@ export = {
'BR',
'BS',
'BT',
'BU',
'BV',
'BW',
'BY',
'BZ',
'CA',
'CC',
'CD',
'CE',
'CF',
'CG',
'CH',
Expand All @@ -1200,40 +1196,32 @@ export = {
'CM',
'CN',
'CO',
'CP',
'CR',
'CS',
'CS',
'CU',
'CV',
'CW',
'CX',
'CY',
'CZ',
'DD',
'DE',
'DG',
'DJ',
'DK',
'DM',
'DO',
'DZ',
'EA',
'EC',
'EE',
'EG',
'EH',
'ER',
'ES',
'ET',
'EU',
'FI',
'FJ',
'FK',
'FM',
'FO',
'FR',
'FX',
'GA',
'GB',
'GD',
Expand All @@ -1259,7 +1247,6 @@ export = {
'HR',
'HT',
'HU',
'IC',
'ID',
'IE',
'IL',
Expand Down Expand Up @@ -1329,7 +1316,6 @@ export = {
'NO',
'NP',
'NR',
'NT',
'NU',
'NZ',
'OM',
Expand Down Expand Up @@ -1370,12 +1356,10 @@ export = {
'SR',
'SS',
'ST',
'SU',
'SV',
'SX',
'SY',
'SZ',
'TA',
'TC',
'TD',
'TF',
Expand Down Expand Up @@ -1407,12 +1391,11 @@ export = {
'VU',
'WF',
'WS',
'XK',
'YE',
'YT',
'YU',
'ZA',
'ZM',
'ZR',
'ZW',
],
};
16 changes: 10 additions & 6 deletions test/finance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const seedRuns = [
creditCardCVV: '251',
ethereumAddress: '0x5c346ba075bd57f5a62b82d72af39cbbb07a98cb',
iban: 'FO7710540350900318',
bic: 'OEFELTL1032',
bic: 'OEFELYL1032',
transactionDescription:
'deposit transaction at Cronin - Effertz using card ending with ***(...1830) for PEN 262.02 in account ***55239273',
},
Expand Down Expand Up @@ -473,11 +473,15 @@ describe('finance', () => {
).toStrictEqual(1);
});

it('throws an error if the passed country code is not supported', () => {
expect(() => faker.finance.iban(false, 'AA')).toThrowError(
Error('Country code AA not supported.')
);
});
it.each(['AA', 'EU'])(
'throws an error for unsupported country code "%s"',
(unsupportedCountryCode) =>
expect(() =>
faker.finance.iban(false, unsupportedCountryCode)
).toThrowError(
Error(`Country code ${unsupportedCountryCode} not supported.`)
)
);
});

describe('bic()', () => {
Expand Down

0 comments on commit 6050d7a

Please sign in to comment.