diff options
| author | ST-DDT <[email protected]> | 2023-11-07 17:42:14 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-07 16:42:14 +0000 |
| commit | e0ba50b37e438503ed1899bff35afc92b4f8f49c (patch) | |
| tree | 20314c515bcddb3698c93a46168715ffc5a98ab4 /test/modules | |
| parent | 8542ef30bd4eda3d9f04db2c4a79abf0369d57c3 (diff) | |
| download | faker-e0ba50b37e438503ed1899bff35afc92b4f8f49c.tar.xz faker-e0ba50b37e438503ed1899bff35afc92b4f8f49c.zip | |
fix(finance): maskedNumber has incorrect defaults (#2494)
Diffstat (limited to 'test/modules')
| -rw-r--r-- | test/modules/__snapshots__/finance.spec.ts.snap | 54 | ||||
| -rw-r--r-- | test/modules/finance.spec.ts | 6 |
2 files changed, 33 insertions, 27 deletions
diff --git a/test/modules/__snapshots__/finance.spec.ts.snap b/test/modules/__snapshots__/finance.spec.ts.snap index b80380b9..324aad22 100644 --- a/test/modules/__snapshots__/finance.spec.ts.snap +++ b/test/modules/__snapshots__/finance.spec.ts.snap @@ -78,23 +78,23 @@ exports[`finance > 42 > iban > with formatted option 1`] = `"GT03 9751 1086 7098 exports[`finance > 42 > litecoinAddress 1`] = `"3XbJMAAara64sSkA9HD24YHQWd1b"`; -exports[`finance > 42 > mask > noArgs 1`] = `"3791"`; +exports[`finance > 42 > mask > noArgs 1`] = `"(...3791)"`; -exports[`finance > 42 > mask > with ellipsis 1`] = `"...3791"`; +exports[`finance > 42 > mask > with ellipsis 1`] = `"(...3791)"`; -exports[`finance > 42 > mask > with length 1`] = `"37917"`; +exports[`finance > 42 > mask > with length 1`] = `"(...37917)"`; exports[`finance > 42 > mask > with length, parenthesis and ellipsis 1`] = `"(...37917)"`; -exports[`finance > 42 > mask > with parenthesis 1`] = `"(3791)"`; +exports[`finance > 42 > mask > with parenthesis 1`] = `"(...3791)"`; -exports[`finance > 42 > maskedNumber > noArgs 1`] = `"3791"`; +exports[`finance > 42 > maskedNumber > noArgs 1`] = `"(...3791)"`; -exports[`finance > 42 > maskedNumber > with length 1`] = `"37917"`; +exports[`finance > 42 > maskedNumber > with length 1`] = `"(...37917)"`; -exports[`finance > 42 > maskedNumber > with length and parenthesis option 1`] = `"37917"`; +exports[`finance > 42 > maskedNumber > with length and parenthesis option 1`] = `"...37917"`; -exports[`finance > 42 > maskedNumber > with length option 1`] = `"37917"`; +exports[`finance > 42 > maskedNumber > with length option 1`] = `"(...37917)"`; exports[`finance > 42 > maskedNumber > with length, parenthesis and ellipsis option 1`] = `"...37917"`; @@ -106,7 +106,7 @@ exports[`finance > 42 > pin > with length option 1`] = `"3791775514"`; exports[`finance > 42 > routingNumber 1`] = `"379177554"`; -exports[`finance > 42 > transactionDescription 1`] = `"invoice transaction at Wiegand, Deckow and Reynolds using card ending with ***8361 for RSD 374.54 in account ***55141004"`; +exports[`finance > 42 > transactionDescription 1`] = `"invoice transaction at Wiegand, Deckow and Reynolds using card ending with ***(...8361) for RSD 374.54 in account ***55141004"`; exports[`finance > 42 > transactionType 1`] = `"withdrawal"`; @@ -188,23 +188,23 @@ exports[`finance > 1211 > iban > with formatted option 1`] = `"TN42 8201 6024 17 exports[`finance > 1211 > litecoinAddress 1`] = `"MTMe8Z3EaFdLqmaGKP1LEEJQVriSZRZds"`; -exports[`finance > 1211 > mask > noArgs 1`] = `"9487"`; +exports[`finance > 1211 > mask > noArgs 1`] = `"(...9487)"`; -exports[`finance > 1211 > mask > with ellipsis 1`] = `"...9487"`; +exports[`finance > 1211 > mask > with ellipsis 1`] = `"(...9487)"`; -exports[`finance > 1211 > mask > with length 1`] = `"94872"`; +exports[`finance > 1211 > mask > with length 1`] = `"(...94872)"`; exports[`finance > 1211 > mask > with length, parenthesis and ellipsis 1`] = `"(...94872)"`; -exports[`finance > 1211 > mask > with parenthesis 1`] = `"(9487)"`; +exports[`finance > 1211 > mask > with parenthesis 1`] = `"(...9487)"`; -exports[`finance > 1211 > maskedNumber > noArgs 1`] = `"9487"`; +exports[`finance > 1211 > maskedNumber > noArgs 1`] = `"(...9487)"`; -exports[`finance > 1211 > maskedNumber > with length 1`] = `"94872"`; +exports[`finance > 1211 > maskedNumber > with length 1`] = `"(...94872)"`; -exports[`finance > 1211 > maskedNumber > with length and parenthesis option 1`] = `"94872"`; +exports[`finance > 1211 > maskedNumber > with length and parenthesis option 1`] = `"...94872"`; -exports[`finance > 1211 > maskedNumber > with length option 1`] = `"94872"`; +exports[`finance > 1211 > maskedNumber > with length option 1`] = `"(...94872)"`; exports[`finance > 1211 > maskedNumber > with length, parenthesis and ellipsis option 1`] = `"...94872"`; @@ -216,7 +216,7 @@ exports[`finance > 1211 > pin > with length option 1`] = `"9487219061"`; exports[`finance > 1211 > routingNumber 1`] = `"948721904"`; -exports[`finance > 1211 > transactionDescription 1`] = `"deposit transaction at Trantow - Satterfield using card ending with ***4316 for SDG 928.52 in account ***19061627"`; +exports[`finance > 1211 > transactionDescription 1`] = `"deposit transaction at Trantow - Satterfield using card ending with ***(...4316) for SDG 928.52 in account ***19061627"`; exports[`finance > 1211 > transactionType 1`] = `"invoice"`; @@ -298,23 +298,23 @@ exports[`finance > 1337 > iban > with formatted option 1`] = `"FO56 1005 0250 09 exports[`finance > 1337 > litecoinAddress 1`] = `"Madhxs2jewAgkYgJi7No6Cn8JZar"`; -exports[`finance > 1337 > mask > noArgs 1`] = `"2512"`; +exports[`finance > 1337 > mask > noArgs 1`] = `"(...2512)"`; -exports[`finance > 1337 > mask > with ellipsis 1`] = `"...2512"`; +exports[`finance > 1337 > mask > with ellipsis 1`] = `"(...2512)"`; -exports[`finance > 1337 > mask > with length 1`] = `"25122"`; +exports[`finance > 1337 > mask > with length 1`] = `"(...25122)"`; exports[`finance > 1337 > mask > with length, parenthesis and ellipsis 1`] = `"(...25122)"`; -exports[`finance > 1337 > mask > with parenthesis 1`] = `"(2512)"`; +exports[`finance > 1337 > mask > with parenthesis 1`] = `"(...2512)"`; -exports[`finance > 1337 > maskedNumber > noArgs 1`] = `"2512"`; +exports[`finance > 1337 > maskedNumber > noArgs 1`] = `"(...2512)"`; -exports[`finance > 1337 > maskedNumber > with length 1`] = `"25122"`; +exports[`finance > 1337 > maskedNumber > with length 1`] = `"(...25122)"`; -exports[`finance > 1337 > maskedNumber > with length and parenthesis option 1`] = `"25122"`; +exports[`finance > 1337 > maskedNumber > with length and parenthesis option 1`] = `"...25122"`; -exports[`finance > 1337 > maskedNumber > with length option 1`] = `"25122"`; +exports[`finance > 1337 > maskedNumber > with length option 1`] = `"(...25122)"`; exports[`finance > 1337 > maskedNumber > with length, parenthesis and ellipsis option 1`] = `"...25122"`; @@ -326,6 +326,6 @@ exports[`finance > 1337 > pin > with length option 1`] = `"2512254032"`; exports[`finance > 1337 > routingNumber 1`] = `"251225401"`; -exports[`finance > 1337 > transactionDescription 1`] = `"withdrawal transaction at Cronin - Effertz using card ending with ***3927 for GIP 262.02 in account ***54032552"`; +exports[`finance > 1337 > transactionDescription 1`] = `"withdrawal transaction at Cronin - Effertz using card ending with ***(...3927) for GIP 262.02 in account ***54032552"`; exports[`finance > 1337 > transactionType 1`] = `"withdrawal"`; diff --git a/test/modules/finance.spec.ts b/test/modules/finance.spec.ts index 93c6a0fc..322e3ba9 100644 --- a/test/modules/finance.spec.ts +++ b/test/modules/finance.spec.ts @@ -217,6 +217,12 @@ describe('finance', () => { }); describe('maskedNumber()', () => { + it('should return contain parenthesis, ellipsis and have a length of 4 by default', () => { + const actual = faker.finance.maskedNumber(); + + expect(actual).toMatch(/\(\.{3}\d{4}\)/); + }); + it('should set a default length', () => { const expected = 4; // default account mask length const mask = faker.finance.maskedNumber({ |
