From f520968e4621c2830c2314f9a59cd1b071f58169 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sat, 2 Apr 2022 13:11:21 +0200 Subject: test: add a general country iban test (#746) --- test/finance_iban.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/finance_iban.spec.ts b/test/finance_iban.spec.ts index b3087a6a..6caaa1a2 100644 --- a/test/finance_iban.spec.ts +++ b/test/finance_iban.spec.ts @@ -9,6 +9,20 @@ describe('finance_iban', () => { // Create and log-back the seed for debug purposes faker.seed(Math.ceil(Math.random() * 1_000_000_000)); + describe('generic IBAN country checks', () => { + it.each( + faker.finance.ibanLib.formats.map( + (entry) => entry.country as string + ) as string[] + )('%s', (country) => { + expect(country).toMatch(/^[A-Z]{2}$/); + const actual = faker.finance.iban(true, country); + + expect(actual).toMatch(new RegExp(`^${country}`)); + expect(actual).satisfy(validator.isIBAN); + }); + }); + describe(`random seeded tests for seed ${JSON.stringify( faker.seedValue )}`, () => { -- cgit v1.2.3