aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEric Cheng <[email protected]>2022-09-22 12:27:19 -0400
committerGitHub <[email protected]>2022-09-22 18:27:19 +0200
commitfe97c29ef888b41582d4ad55753c7eb7e4bac6fc (patch)
tree224c22d1caf7b59008e0d0137a9d75cd7b85764c /test
parentea8d873c5388f405fbdd18ad4ff978bc49996868 (diff)
downloadfaker-fe97c29ef888b41582d4ad55753c7eb7e4bac6fc.tar.xz
faker-fe97c29ef888b41582d4ad55753c7eb7e4bac6fc.zip
feat(finance): branch code option in bic() (#1378)
Diffstat (limited to 'test')
-rw-r--r--test/__snapshots__/finance.spec.ts.snap12
-rw-r--r--test/finance.spec.ts15
2 files changed, 22 insertions, 5 deletions
diff --git a/test/__snapshots__/finance.spec.ts.snap b/test/__snapshots__/finance.spec.ts.snap
index e42b6c80..8b23a56d 100644
--- a/test/__snapshots__/finance.spec.ts.snap
+++ b/test/__snapshots__/finance.spec.ts.snap
@@ -16,7 +16,9 @@ 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`] = `"JUYEPSSLXXX"`;
+exports[`finance > 42 > bic > noArgs 1`] = `"UYETSCLL"`;
+
+exports[`finance > 42 > bic > with branch code 1`] = `"JUYEPSSL5G5"`;
exports[`finance > 42 > bitcoinAddress 1`] = `"3XbJMAAara64sSkA9HD24YHQWd1bZb"`;
@@ -80,7 +82,9 @@ 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`] = `"YLXUDE4Z"`;
+exports[`finance > 1211 > bic > noArgs 1`] = `"LXUFBTZ15O7"`;
+
+exports[`finance > 1211 > bic > with branch code 1`] = `"YLXUDE4ZXXX"`;
exports[`finance > 1211 > bitcoinAddress 1`] = `"1TMe8Z3EaFdLqmaGKP1LEEJQVriSZRZdsAUc9n"`;
@@ -144,7 +148,9 @@ 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`] = `"GOEFFIJG"`;
+exports[`finance > 1337 > bic > noArgs 1`] = `"OEFHLYG1"`;
+
+exports[`finance > 1337 > bic > with branch code 1`] = `"GOEFFIJGXXX"`;
exports[`finance > 1337 > bitcoinAddress 1`] = `"3adhxs2jewAgkYgJi7No6Cn8JZar"`;
diff --git a/test/finance.spec.ts b/test/finance.spec.ts
index 70534449..730bfe78 100644
--- a/test/finance.spec.ts
+++ b/test/finance.spec.ts
@@ -26,7 +26,6 @@ describe('finance', () => {
'litecoinAddress',
'creditCardCVV',
'ethereumAddress',
- 'bic',
'transactionDescription'
);
@@ -45,6 +44,10 @@ describe('finance', () => {
.it('with min and max and dec and symbol', 10, 50, 5, '$');
});
+ t.describe('bic', (t) => {
+ t.it('noArgs').it('with branch code', { includeBranchCode: true });
+ });
+
t.describe('iban', (t) => {
t.it('noArgs')
.it('with formatted', true)
@@ -481,13 +484,21 @@ describe('finance', () => {
});
describe('bic()', () => {
- it('should return a random yet formally correct BIC number', () => {
+ it('should return a BIC number', () => {
const bic = faker.finance.bic();
expect(bic).toBeTypeOf('string');
expect(bic).toMatch(/^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/);
expect(ibanLib.iso3166).toContain(bic.substring(4, 6));
});
+
+ it('should return a BIC number with branch code', () => {
+ const bic = faker.finance.bic({ includeBranchCode: true });
+
+ expect(bic).toBeTypeOf('string');
+ expect(bic).toMatch(/^[A-Z]{6}[A-Z0-9]{2}[A-Z0-9]{3}$/);
+ expect(ibanLib.iso3166).toContain(bic.substring(4, 6));
+ });
});
describe('transactionDescription()', () => {