diff options
| author | ST-DDT <[email protected]> | 2022-04-02 13:11:21 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-02 11:11:21 +0000 |
| commit | f520968e4621c2830c2314f9a59cd1b071f58169 (patch) | |
| tree | 1d6f4ac4d774462761bee7ba4bc5d7ccf4ef2141 | |
| parent | 492f390f621657c05538ceb6d8b9b5c8783b8d1f (diff) | |
| download | faker-f520968e4621c2830c2314f9a59cd1b071f58169.tar.xz faker-f520968e4621c2830c2314f9a59cd1b071f58169.zip | |
test: add a general country iban test (#746)
| -rw-r--r-- | test/finance_iban.spec.ts | 14 |
1 files changed, 14 insertions, 0 deletions
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 )}`, () => { |
