From 6050d7acbb991568cbdac7b0c16a088aef200abc Mon Sep 17 00:00:00 2001 From: Benjamin MENANT Date: Mon, 21 Mar 2022 21:37:03 +0900 Subject: [PATCH] fix(finance): update iso-3166-1 country codes for IBAN/BIC (#168) --- src/iban.ts | 19 +------------------ test/finance.spec.ts | 16 ++++++++++------ 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/iban.ts b/src/iban.ts index 0c90253423d..3f10e91be2e 100644 --- a/src/iban.ts +++ b/src/iban.ts @@ -1147,7 +1147,6 @@ export = { }, ], iso3166: [ - 'AC', 'AD', 'AE', 'AF', @@ -1155,7 +1154,6 @@ export = { 'AI', 'AL', 'AM', - 'AN', 'AO', 'AQ', 'AR', @@ -1182,7 +1180,6 @@ export = { 'BR', 'BS', 'BT', - 'BU', 'BV', 'BW', 'BY', @@ -1190,7 +1187,6 @@ export = { 'CA', 'CC', 'CD', - 'CE', 'CF', 'CG', 'CH', @@ -1200,25 +1196,19 @@ 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', @@ -1226,14 +1216,12 @@ export = { 'ER', 'ES', 'ET', - 'EU', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', - 'FX', 'GA', 'GB', 'GD', @@ -1259,7 +1247,6 @@ export = { 'HR', 'HT', 'HU', - 'IC', 'ID', 'IE', 'IL', @@ -1329,7 +1316,6 @@ export = { 'NO', 'NP', 'NR', - 'NT', 'NU', 'NZ', 'OM', @@ -1370,12 +1356,10 @@ export = { 'SR', 'SS', 'ST', - 'SU', 'SV', 'SX', 'SY', 'SZ', - 'TA', 'TC', 'TD', 'TF', @@ -1407,12 +1391,11 @@ export = { 'VU', 'WF', 'WS', + 'XK', 'YE', 'YT', - 'YU', 'ZA', 'ZM', - 'ZR', 'ZW', ], }; diff --git a/test/finance.spec.ts b/test/finance.spec.ts index 227184c148d..d49e29a30f8 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -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', }, @@ -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()', () => {