aboutsummaryrefslogtreecommitdiff
path: root/test/modules
diff options
context:
space:
mode:
authorOwen <[email protected]>2025-03-06 12:08:47 -0500
committerGitHub <[email protected]>2025-03-06 17:08:47 +0000
commitae9aec67b19f779e818be5550a8edc44f20d91d4 (patch)
tree5feaada57958f8e52bf791e91fc00c4893b5ff4f /test/modules
parent57d39d74429557a9ebbf777a0c0f413e7851d3fc (diff)
downloadfaker-ae9aec67b19f779e818be5550a8edc44f20d91d4.tar.xz
faker-ae9aec67b19f779e818be5550a8edc44f20d91d4.zip
feat(finance): add ISO 4217 numerical codes to Currency (#3404)
Diffstat (limited to 'test/modules')
-rw-r--r--test/modules/__snapshots__/finance.spec.ts.snap9
-rw-r--r--test/modules/finance.spec.ts11
2 files changed, 20 insertions, 0 deletions
diff --git a/test/modules/__snapshots__/finance.spec.ts.snap b/test/modules/__snapshots__/finance.spec.ts.snap
index 7d657322..2e3cc65d 100644
--- a/test/modules/__snapshots__/finance.spec.ts.snap
+++ b/test/modules/__snapshots__/finance.spec.ts.snap
@@ -46,6 +46,7 @@ exports[`finance > 42 > currency 1`] = `
{
"code": "ILS",
"name": "New Israeli Sheqel",
+ "numericCode": "376",
"symbol": "₪",
}
`;
@@ -54,6 +55,8 @@ exports[`finance > 42 > currencyCode 1`] = `"ILS"`;
exports[`finance > 42 > currencyName 1`] = `"New Israeli Sheqel"`;
+exports[`finance > 42 > currencyNumericCode 1`] = `"376"`;
+
exports[`finance > 42 > currencySymbol 1`] = `"₪"`;
exports[`finance > 42 > ethereumAddress 1`] = `"0x8ead331ddf0fc4446b96d368ab4bd1d31efb62f9"`;
@@ -134,6 +137,7 @@ exports[`finance > 1211 > currency 1`] = `
{
"code": "VUV",
"name": "Vatu",
+ "numericCode": "548",
"symbol": "",
}
`;
@@ -142,6 +146,8 @@ exports[`finance > 1211 > currencyCode 1`] = `"VUV"`;
exports[`finance > 1211 > currencyName 1`] = `"Vatu"`;
+exports[`finance > 1211 > currencyNumericCode 1`] = `"548"`;
+
exports[`finance > 1211 > currencySymbol 1`] = `"$"`;
exports[`finance > 1211 > ethereumAddress 1`] = `"0xed4fefa7fbaec9dc4c48fa8ebf46fb7c8563cf3f"`;
@@ -222,6 +228,7 @@ exports[`finance > 1337 > currency 1`] = `
{
"code": "ETB",
"name": "Ethiopian Birr",
+ "numericCode": "230",
"symbol": "",
}
`;
@@ -230,6 +237,8 @@ exports[`finance > 1337 > currencyCode 1`] = `"ETB"`;
exports[`finance > 1337 > currencyName 1`] = `"Ethiopian Birr"`;
+exports[`finance > 1337 > currencyNumericCode 1`] = `"230"`;
+
exports[`finance > 1337 > currencySymbol 1`] = `"$"`;
exports[`finance > 1337 > ethereumAddress 1`] = `"0x536a7b5fa28d2f9bb79ca46ea394bc4f9bb0af32"`;
diff --git a/test/modules/finance.spec.ts b/test/modules/finance.spec.ts
index 29b490d2..82ea482e 100644
--- a/test/modules/finance.spec.ts
+++ b/test/modules/finance.spec.ts
@@ -24,6 +24,7 @@ describe('finance', () => {
'currencyCode',
'currencyName',
'currencySymbol',
+ 'currencyNumericCode',
'litecoinAddress',
'creditCardCVV',
'ethereumAddress',
@@ -298,6 +299,7 @@ describe('finance', () => {
expect(currency.code).toMatch(/^[A-Z]{3}$/);
expect(currency.name).toBeTypeOf('string');
expect(currency.symbol).toBeTypeOf('string');
+ expect(currency.numericCode).toBeTypeOf('string');
});
});
@@ -326,6 +328,15 @@ describe('finance', () => {
});
});
+ describe('currencyNumericCode()', () => {
+ it('should return a string with length of 3', () => {
+ const currencyNumericCode = faker.finance.currencyNumericCode();
+
+ expect(currencyNumericCode).toBeTypeOf('string');
+ expect(currencyNumericCode).toMatch(/^\d{3}$/);
+ });
+ });
+
describe('bitcoinAddress()', () => {
const m_legacy = /^1[A-HJ-NP-Za-km-z1-9]{25,39}$/;
const t_legacy = /^m[A-HJ-NP-Za-km-z1-9]{25,39}$/;