aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHanna <[email protected]>2022-08-01 21:04:21 +0200
committerGitHub <[email protected]>2022-08-01 19:04:21 +0000
commit5a397e0f8a6b4651a5b093b8eafe4895bf166845 (patch)
tree4c965e5bc7546887fc3ec164b5b2d4d9301544a9 /test
parentaafab45917ce01a3b445caff8ef3d17382535ceb (diff)
downloadfaker-5a397e0f8a6b4651a5b093b8eafe4895bf166845.tar.xz
faker-5a397e0f8a6b4651a5b093b8eafe4895bf166845.zip
fix(finance.bic): remove hardcoded elements and simplify function (#1171)
Diffstat (limited to 'test')
-rw-r--r--test/__snapshots__/finance.spec.ts.snap6
-rw-r--r--test/finance.spec.ts9
2 files changed, 5 insertions, 10 deletions
diff --git a/test/__snapshots__/finance.spec.ts.snap b/test/__snapshots__/finance.spec.ts.snap
index f45679f4..1e7486db 100644
--- a/test/__snapshots__/finance.spec.ts.snap
+++ b/test/__snapshots__/finance.spec.ts.snap
@@ -16,7 +16,7 @@ exports[`finance > 42 > amount > with min 1`] = `"380.79"`;
exports[`finance > 42 > amount > with min and max and dec and symbol 1`] = `"$24.98160"`;
-exports[`finance > 42 > bic 1`] = `"UYEOSCP1514"`;
+exports[`finance > 42 > bic 1`] = `"JUYEPSSLXXX"`;
exports[`finance > 42 > bitcoinAddress 1`] = `"3XbJMAAara64sSkA9HD24YHQWd1b"`;
@@ -80,7 +80,7 @@ exports[`finance > 1211 > amount > with min 1`] = `"929.24"`;
exports[`finance > 1211 > amount > with min and max and dec and symbol 1`] = `"$47.14081"`;
-exports[`finance > 1211 > bic 1`] = `"LXUEBTZ1"`;
+exports[`finance > 1211 > bic 1`] = `"YLXUDE4Z"`;
exports[`finance > 1211 > bitcoinAddress 1`] = `"1TMe8Z3EaFdLqmaGKP1LEEJQVriSZRZdsA"`;
@@ -144,7 +144,7 @@ exports[`finance > 1337 > amount > with min 1`] = `"269.40"`;
exports[`finance > 1337 > amount > with min and max and dec and symbol 1`] = `"$20.48098"`;
-exports[`finance > 1337 > bic 1`] = `"OEFELYL1032"`;
+exports[`finance > 1337 > bic 1`] = `"GOEFFIJG"`;
exports[`finance > 1337 > bitcoinAddress 1`] = `"3adhxs2jewAgkYgJi7No6Cn8JZa"`;
diff --git a/test/finance.spec.ts b/test/finance.spec.ts
index b1aed4ad..afc671a7 100644
--- a/test/finance.spec.ts
+++ b/test/finance.spec.ts
@@ -482,15 +482,10 @@ describe('finance', () => {
describe('bic()', () => {
it('should return a random yet formally correct BIC number', () => {
const bic = faker.finance.bic();
- const expr = new RegExp(
- `^[A-Z]{4}(${ibanLib.iso3166.join(
- '|'
- )})[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3})?\$`,
- 'i'
- );
expect(bic).toBeTypeOf('string');
- expect(bic).toMatch(expr);
+ expect(bic).toMatch(/^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/);
+ expect(ibanLib.iso3166).toContain(bic.substring(4, 6));
});
});