diff options
| author | Shinigami <[email protected]> | 2025-07-04 20:23:30 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-04 18:23:30 +0000 |
| commit | 623d2741a4ca165596fad7fede2f850b6c08aa3a (patch) | |
| tree | c05531e1f25bea9201925c0342d22e9a50f8946f /test/modules | |
| parent | 160960b79719e1298668a7ebba390b30b8de1080 (diff) | |
| download | faker-623d2741a4ca165596fad7fede2f850b6c08aa3a.tar.xz faker-623d2741a4ca165596fad7fede2f850b6c08aa3a.zip | |
refactor!: remove deprecations (#3553)
Diffstat (limited to 'test/modules')
| -rw-r--r-- | test/modules/__snapshots__/finance.spec.ts.snap | 30 | ||||
| -rw-r--r-- | test/modules/__snapshots__/image.spec.ts.snap | 66 | ||||
| -rw-r--r-- | test/modules/__snapshots__/internet.spec.ts.snap | 78 | ||||
| -rw-r--r-- | test/modules/date.spec.ts | 16 | ||||
| -rw-r--r-- | test/modules/finance.spec.ts | 49 | ||||
| -rw-r--r-- | test/modules/helpers-eval.spec.ts | 13 | ||||
| -rw-r--r-- | test/modules/helpers.spec.ts | 11 | ||||
| -rw-r--r-- | test/modules/image.spec.ts | 53 | ||||
| -rw-r--r-- | test/modules/internet.spec.ts | 114 |
9 files changed, 6 insertions, 424 deletions
diff --git a/test/modules/__snapshots__/finance.spec.ts.snap b/test/modules/__snapshots__/finance.spec.ts.snap index 2e3cc65d..589d338e 100644 --- a/test/modules/__snapshots__/finance.spec.ts.snap +++ b/test/modules/__snapshots__/finance.spec.ts.snap @@ -69,16 +69,6 @@ exports[`finance > 42 > iban > with formatted option 1`] = `"GT69 T10P 0V13 4624 exports[`finance > 42 > litecoinAddress 1`] = `"3JAaa4SAH2YQdbbiwrhB9hnsMcvA"`; -exports[`finance > 42 > maskedNumber > noArgs 1`] = `"(...3975)"`; - -exports[`finance > 42 > maskedNumber > with length 1`] = `"(...39751)"`; - -exports[`finance > 42 > maskedNumber > with length and parenthesis option 1`] = `"...39751"`; - -exports[`finance > 42 > maskedNumber > with length option 1`] = `"(...39751)"`; - -exports[`finance > 42 > maskedNumber > with length, parenthesis and ellipsis option 1`] = `"...39751"`; - exports[`finance > 42 > pin > noArgs 1`] = `"3975"`; exports[`finance > 42 > pin > with length 1`] = `"3975110867"`; @@ -160,16 +150,6 @@ exports[`finance > 1211 > iban > with formatted option 1`] = `"TN83 2673 6788 21 exports[`finance > 1211 > litecoinAddress 1`] = `"3eZEFLmGPLEQrSRdAcnZLoWwYeiHwmRog"`; -exports[`finance > 1211 > maskedNumber > noArgs 1`] = `"(...9829)"`; - -exports[`finance > 1211 > maskedNumber > with length 1`] = `"(...98296)"`; - -exports[`finance > 1211 > maskedNumber > with length and parenthesis option 1`] = `"...98296"`; - -exports[`finance > 1211 > maskedNumber > with length option 1`] = `"(...98296)"`; - -exports[`finance > 1211 > maskedNumber > with length, parenthesis and ellipsis option 1`] = `"...98296"`; - exports[`finance > 1211 > pin > noArgs 1`] = `"9829"`; exports[`finance > 1211 > pin > with length 1`] = `"9829667368"`; @@ -251,16 +231,6 @@ exports[`finance > 1337 > iban > with formatted option 1`] = `"FO22 0053 2700 60 exports[`finance > 1337 > litecoinAddress 1`] = `"LhsjwgYJ7oC8ZrMNmqzLbhEubpcw"`; -exports[`finance > 1337 > maskedNumber > noArgs 1`] = `"(...2124)"`; - -exports[`finance > 1337 > maskedNumber > with length 1`] = `"(...21243)"`; - -exports[`finance > 1337 > maskedNumber > with length and parenthesis option 1`] = `"...21243"`; - -exports[`finance > 1337 > maskedNumber > with length option 1`] = `"(...21243)"`; - -exports[`finance > 1337 > maskedNumber > with length, parenthesis and ellipsis option 1`] = `"...21243"`; - exports[`finance > 1337 > pin > noArgs 1`] = `"2124"`; exports[`finance > 1337 > pin > with length 1`] = `"2124352971"`; diff --git a/test/modules/__snapshots__/image.spec.ts.snap b/test/modules/__snapshots__/image.spec.ts.snap index 2bcbe1a3..9b2ea957 100644 --- a/test/modules/__snapshots__/image.spec.ts.snap +++ b/test/modules/__snapshots__/image.spec.ts.snap @@ -4,8 +4,6 @@ exports[`image > 42 > avatar 1`] = `"https://cdn.jsdelivr.net/gh/faker-js/assets exports[`image > 42 > avatarGitHub 1`] = `"https://avatars.githubusercontent.com/u/37454012"`; -exports[`image > 42 > avatarLegacy 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/468.jpg"`; - exports[`image > 42 > dataUri > noArgs 1`] = `"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgYmFzZVByb2ZpbGU9ImZ1bGwiIHdpZHRoPSIxNDk4IiBoZWlnaHQ9IjM4MDIiPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiNhZDMzMWQiLz48dGV4dCB4PSI3NDkiIHk9IjE5MDEiIGZvbnQtc2l6ZT0iMjAiIGFsaWdubWVudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmaWxsPSJ3aGl0ZSI+MTQ5OHgzODAyPC90ZXh0Pjwvc3ZnPg=="`; exports[`image > 42 > dataUri > with all options+base64 1`] = `"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgYmFzZVByb2ZpbGU9ImZ1bGwiIHdpZHRoPSIyIiBoZWlnaHQ9IjEzMzciPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiM2NDMyMTgiLz48dGV4dCB4PSIxIiB5PSI2NjguNSIgZm9udC1zaXplPSIyMCIgYWxpZ25tZW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZpbGw9IndoaXRlIj4yeDEzMzc8L3RleHQ+PC9zdmc+"`; @@ -64,32 +62,10 @@ exports[`image > 42 > urlPicsumPhotos > with width 1`] = `"https://picsum.photos exports[`image > 42 > urlPicsumPhotos > with width and height 1`] = `"https://picsum.photos/seed/B993RBH1Y/128/128?grayscale&blur=10"`; -exports[`image > 42 > urlPlaceholder > noArgs 1`] = `"https://via.placeholder.com/1311x3328/ad331d/df0fc4.gif?text=auctus%20cognomen%20esse"`; - -exports[`image > 42 > urlPlaceholder > with all options 1`] = `"https://via.placeholder.com/128x128/FF0000/0000FF.png?text=hello"`; - -exports[`image > 42 > urlPlaceholder > with backgroundColor 1`] = `"https://via.placeholder.com/1311x3328/FF0000/ad331d.png?text=suggero%20accusator%20volubilis"`; - -exports[`image > 42 > urlPlaceholder > with empty colors and text 1`] = `"https://via.placeholder.com/128x128//.png?text="`; - -exports[`image > 42 > urlPlaceholder > with format 1`] = `"https://via.placeholder.com/1311x3328/ad331d/df0fc4.webp?text=attonbitus%20auctus%20cognomen"`; - -exports[`image > 42 > urlPlaceholder > with height 1`] = `"https://via.placeholder.com/1311x128/ead331/ddf0fc.jpeg?text=attonbitus%20auctus%20cognomen"`; - -exports[`image > 42 > urlPlaceholder > with text 1`] = `"https://via.placeholder.com/1311x3328/ad331d/df0fc4.gif?text=Hello"`; - -exports[`image > 42 > urlPlaceholder > with textColor 1`] = `"https://via.placeholder.com/1311x3328/ad331d/0000FF.png?text=suggero%20accusator%20volubilis"`; - -exports[`image > 42 > urlPlaceholder > with width 1`] = `"https://via.placeholder.com/128x1311/ead331/ddf0fc.jpeg?text=attonbitus%20auctus%20cognomen"`; - -exports[`image > 42 > urlPlaceholder > with width and height 1`] = `"https://via.placeholder.com/128x128/8ead33/1ddf0f.webp?text=benevolentia%20attonbitus%20auctus"`; - exports[`image > 1211 > avatar 1`] = `"https://avatars.githubusercontent.com/u/89347165"`; exports[`image > 1211 > avatarGitHub 1`] = `"https://avatars.githubusercontent.com/u/92852016"`; -exports[`image > 1211 > avatarLegacy 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1160.jpg"`; - exports[`image > 1211 > dataUri > noArgs 1`] = `"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgYmFzZVByb2ZpbGU9ImZ1bGwiIHdpZHRoPSIzNzE0IiBoZWlnaHQ9IjM1NzMiPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiM0ZmVmYTciLz48dGV4dCB4PSIxODU3IiB5PSIxNzg2LjUiIGZvbnQtc2l6ZT0iMjAiIGFsaWdubWVudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmaWxsPSJ3aGl0ZSI+MzcxNHgzNTczPC90ZXh0Pjwvc3ZnPg=="`; exports[`image > 1211 > dataUri > with all options+base64 1`] = `"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgYmFzZVByb2ZpbGU9ImZ1bGwiIHdpZHRoPSIyIiBoZWlnaHQ9IjEzMzciPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiM2NDMyMTgiLz48dGV4dCB4PSIxIiB5PSI2NjguNSIgZm9udC1zaXplPSIyMCIgYWxpZ25tZW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZpbGw9IndoaXRlIj4yeDEzMzc8L3RleHQ+PC9zdmc+"`; @@ -148,32 +124,10 @@ exports[`image > 1211 > urlPicsumPhotos > with width 1`] = `"https://picsum.phot exports[`image > 1211 > urlPicsumPhotos > with width and height 1`] = `"https://picsum.photos/seed/ZFGLlH/128/128?blur=9"`; -exports[`image > 1211 > urlPlaceholder > noArgs 1`] = `"https://via.placeholder.com/3250x3128/4fefa7/fbaec9.webp?text=unde%20blanditiis%20officia"`; - -exports[`image > 1211 > urlPlaceholder > with all options 1`] = `"https://via.placeholder.com/128x128/FF0000/0000FF.png?text=hello"`; - -exports[`image > 1211 > urlPlaceholder > with backgroundColor 1`] = `"https://via.placeholder.com/3250x3128/FF0000/4fefa7.png?text=tonsor%20tenuis%20sollers"`; - -exports[`image > 1211 > urlPlaceholder > with empty colors and text 1`] = `"https://via.placeholder.com/128x128//.png?text="`; - -exports[`image > 1211 > urlPlaceholder > with format 1`] = `"https://via.placeholder.com/3250x3128/4fefa7/fbaec9.webp?text=usque%20unde%20blanditiis"`; - -exports[`image > 1211 > urlPlaceholder > with height 1`] = `"https://via.placeholder.com/3250x128/d4fefa/7fbaec.jpg?text=usque%20unde%20blanditiis"`; - -exports[`image > 1211 > urlPlaceholder > with text 1`] = `"https://via.placeholder.com/3250x3128/4fefa7/fbaec9.webp?text=Hello"`; - -exports[`image > 1211 > urlPlaceholder > with textColor 1`] = `"https://via.placeholder.com/3250x3128/4fefa7/0000FF.png?text=tonsor%20tenuis%20sollers"`; - -exports[`image > 1211 > urlPlaceholder > with width 1`] = `"https://via.placeholder.com/128x3250/d4fefa/7fbaec.jpg?text=usque%20unde%20blanditiis"`; - -exports[`image > 1211 > urlPlaceholder > with width and height 1`] = `"https://via.placeholder.com/128x128/ed4fef/a7fbae.webp?text=dapifer%20usque%20unde"`; - exports[`image > 1337 > avatar 1`] = `"https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/27.jpg"`; exports[`image > 1337 > avatarGitHub 1`] = `"https://avatars.githubusercontent.com/u/26202467"`; -exports[`image > 1337 > avatarLegacy 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/327.jpg"`; - exports[`image > 1337 > dataUri > noArgs 1`] = `"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgYmFzZVByb2ZpbGU9ImZ1bGwiIHdpZHRoPSIxMDQ4IiBoZWlnaHQ9IjYzNSI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0iIzZhN2I1ZiIvPjx0ZXh0IHg9IjUyNCIgeT0iMzE3LjUiIGZvbnQtc2l6ZT0iMjAiIGFsaWdubWVudC1iYXNlbGluZT0ibWlkZGxlIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmaWxsPSJ3aGl0ZSI+MTA0OHg2MzU8L3RleHQ+PC9zdmc+"`; exports[`image > 1337 > dataUri > with all options+base64 1`] = `"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgYmFzZVByb2ZpbGU9ImZ1bGwiIHdpZHRoPSIyIiBoZWlnaHQ9IjEzMzciPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9IiM2NDMyMTgiLz48dGV4dCB4PSIxIiB5PSI2NjguNSIgZm9udC1zaXplPSIyMCIgYWxpZ25tZW50LWJhc2VsaW5lPSJtaWRkbGUiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZpbGw9IndoaXRlIj4yeDEzMzc8L3RleHQ+PC9zdmc+"`; @@ -231,23 +185,3 @@ exports[`image > 1337 > urlPicsumPhotos > with height 1`] = `"https://picsum.pho exports[`image > 1337 > urlPicsumPhotos > with width 1`] = `"https://picsum.photos/seed/jwgYJ7n/128/1048?grayscale&blur=3"`; exports[`image > 1337 > urlPicsumPhotos > with width and height 1`] = `"https://picsum.photos/seed/sjwgYJ/128/128?grayscale&blur=1"`; - -exports[`image > 1337 > urlPlaceholder > noArgs 1`] = `"https://via.placeholder.com/918x556/6a7b5f/a28d2f.jpg?text=testimonium%20thalassinus%20contra"`; - -exports[`image > 1337 > urlPlaceholder > with all options 1`] = `"https://via.placeholder.com/128x128/FF0000/0000FF.png?text=hello"`; - -exports[`image > 1337 > urlPlaceholder > with backgroundColor 1`] = `"https://via.placeholder.com/918x556/FF0000/6a7b5f.png?text=ancilla%20creptio%20quisquam"`; - -exports[`image > 1337 > urlPlaceholder > with empty colors and text 1`] = `"https://via.placeholder.com/128x128//.png?text="`; - -exports[`image > 1337 > urlPlaceholder > with format 1`] = `"https://via.placeholder.com/918x556/6a7b5f/a28d2f.webp?text=decipio%20testimonium%20thalassinus"`; - -exports[`image > 1337 > urlPlaceholder > with height 1`] = `"https://via.placeholder.com/918x128/36a7b5/fa28d2.webp?text=decipio%20testimonium%20thalassinus"`; - -exports[`image > 1337 > urlPlaceholder > with text 1`] = `"https://via.placeholder.com/918x556/6a7b5f/a28d2f.jpg?text=Hello"`; - -exports[`image > 1337 > urlPlaceholder > with textColor 1`] = `"https://via.placeholder.com/918x556/6a7b5f/0000FF.png?text=ancilla%20creptio%20quisquam"`; - -exports[`image > 1337 > urlPlaceholder > with width 1`] = `"https://via.placeholder.com/128x918/36a7b5/fa28d2.webp?text=decipio%20testimonium%20thalassinus"`; - -exports[`image > 1337 > urlPlaceholder > with width and height 1`] = `"https://via.placeholder.com/128x128/536a7b/5fa28d.gif?text=vorago%20decipio%20testimonium"`; diff --git a/test/modules/__snapshots__/internet.spec.ts.snap b/test/modules/__snapshots__/internet.spec.ts.snap index 53aaa5b4..2e233221 100644 --- a/test/modules/__snapshots__/internet.spec.ts.snap +++ b/test/modules/__snapshots__/internet.spec.ts.snap @@ -1,15 +1,5 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`internet > 42 > color > noArgs 1`] = `"#307a5e"`; - -exports[`internet > 42 > color > with all options 1`] = `"#62ac90"`; - -exports[`internet > 42 > color > with blueBase option 1`] = `"#307a90"`; - -exports[`internet > 42 > color > with greenBase option 1`] = `"#30ac5e"`; - -exports[`internet > 42 > color > with redBase option 1`] = `"#627a5e"`; - exports[`internet > 42 > displayName > noArgs 1`] = `"Garnet15"`; exports[`internet > 42 > displayName > with Chinese names 1`] = `"大羽.陳95"`; @@ -112,22 +102,6 @@ exports[`internet > 42 > url > without slash appended and with http protocol 1`] exports[`internet > 42 > userAgent 1`] = `"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/118.0"`; -exports[`internet > 42 > userName > noArgs 1`] = `"Garnet.Reynolds-Miller15"`; - -exports[`internet > 42 > userName > with Chinese names 1`] = `"hlzp8d.tpv"`; - -exports[`internet > 42 > userName > with Cyrillic names 1`] = `"Fedor.Dostoevskii"`; - -exports[`internet > 42 > userName > with Latin names 1`] = `"Jane.Doe"`; - -exports[`internet > 42 > userName > with accented names 1`] = `"Helene.Muller"`; - -exports[`internet > 42 > userName > with all option 1`] = `"Jane.Doe"`; - -exports[`internet > 42 > userName > with firstName option 1`] = `"Jane_Wiegand59"`; - -exports[`internet > 42 > userName > with lastName option 1`] = `"Garnet_Doe"`; - exports[`internet > 42 > username > noArgs 1`] = `"Garnet.Reynolds-Miller15"`; exports[`internet > 42 > username > with Chinese names 1`] = `"hlzp8d.tpv"`; @@ -144,16 +118,6 @@ exports[`internet > 42 > username > with firstName option 1`] = `"Jane_Wiegand59 exports[`internet > 42 > username > with lastName option 1`] = `"Garnet_Doe"`; -exports[`internet > 1211 > color > noArgs 1`] = `"#77721c"`; - -exports[`internet > 1211 > color > with all options 1`] = `"#a9a44e"`; - -exports[`internet > 1211 > color > with blueBase option 1`] = `"#77724e"`; - -exports[`internet > 1211 > color > with greenBase option 1`] = `"#77a41c"`; - -exports[`internet > 1211 > color > with redBase option 1`] = `"#a9721c"`; - exports[`internet > 1211 > displayName > noArgs 1`] = `"Tito_Fahey67"`; exports[`internet > 1211 > displayName > with Chinese names 1`] = `"大羽89"`; @@ -256,22 +220,6 @@ exports[`internet > 1211 > url > without slash appended and with http protocol 1 exports[`internet > 1211 > userAgent 1`] = `"Mozilla/5.0 (iPhone; CPU iPhone OS 18_1 like Mac OS X) AppleWebKit/605.67.68 (KHTML, like Gecko) Version/16_1 Mobile/15E148 Safari/584.81"`; -exports[`internet > 1211 > userName > noArgs 1`] = `"Tito67"`; - -exports[`internet > 1211 > userName > with Chinese names 1`] = `"hlzp8d_tpv89"`; - -exports[`internet > 1211 > userName > with Cyrillic names 1`] = `"Fedor_Dostoevskii89"`; - -exports[`internet > 1211 > userName > with Latin names 1`] = `"Jane_Doe89"`; - -exports[`internet > 1211 > userName > with accented names 1`] = `"Helene_Muller89"`; - -exports[`internet > 1211 > userName > with all option 1`] = `"Jane_Doe89"`; - -exports[`internet > 1211 > userName > with firstName option 1`] = `"Jane99"`; - -exports[`internet > 1211 > userName > with lastName option 1`] = `"Tito_Doe"`; - exports[`internet > 1211 > username > noArgs 1`] = `"Tito67"`; exports[`internet > 1211 > username > with Chinese names 1`] = `"hlzp8d_tpv89"`; @@ -288,16 +236,6 @@ exports[`internet > 1211 > username > with firstName option 1`] = `"Jane99"`; exports[`internet > 1211 > username > with lastName option 1`] = `"Tito_Doe"`; -exports[`internet > 1337 > color > noArgs 1`] = `"#211423"`; - -exports[`internet > 1337 > color > with all options 1`] = `"#534655"`; - -exports[`internet > 1337 > color > with blueBase option 1`] = `"#211455"`; - -exports[`internet > 1337 > color > with greenBase option 1`] = `"#214623"`; - -exports[`internet > 1337 > color > with redBase option 1`] = `"#531423"`; - exports[`internet > 1337 > displayName > noArgs 1`] = `"Devyn.Gottlieb"`; exports[`internet > 1337 > displayName > with Chinese names 1`] = `"大羽15"`; @@ -400,22 +338,6 @@ exports[`internet > 1337 > url > without slash appended and with http protocol 1 exports[`internet > 1337 > userAgent 1`] = `"Mozilla/5.0 (Linux; Android 6; SM-G998B) AppleWebKit/568.32 (KHTML, like Gecko) Chrome/94.2.20.15 Mobile Safari/544.38"`; -exports[`internet > 1337 > userName > noArgs 1`] = `"Devyn.Gottlieb"`; - -exports[`internet > 1337 > userName > with Chinese names 1`] = `"hlzp8d.tpv15"`; - -exports[`internet > 1337 > userName > with Cyrillic names 1`] = `"Fedor.Dostoevskii15"`; - -exports[`internet > 1337 > userName > with Latin names 1`] = `"Jane.Doe15"`; - -exports[`internet > 1337 > userName > with accented names 1`] = `"Helene.Muller15"`; - -exports[`internet > 1337 > userName > with all option 1`] = `"Jane.Doe15"`; - -exports[`internet > 1337 > userName > with firstName option 1`] = `"Jane.Cronin45"`; - -exports[`internet > 1337 > userName > with lastName option 1`] = `"Devyn.Doe27"`; - exports[`internet > 1337 > username > noArgs 1`] = `"Devyn.Gottlieb"`; exports[`internet > 1337 > username > with Chinese names 1`] = `"hlzp8d.tpv15"`; diff --git a/test/modules/date.spec.ts b/test/modules/date.spec.ts index 19a2d0a7..f93135ba 100644 --- a/test/modules/date.spec.ts +++ b/test/modules/date.spec.ts @@ -612,22 +612,6 @@ describe('date', () => { expect(age).toBeLessThanOrEqual(22); }); - it.each(['min', 'max', 'mode'] as const)( - "should throw an error when '%s' is not provided", - (key) => { - const options = { min: 18, max: 80, mode: 'age' } as const; - - // eslint-disable-next-line @typescript-eslint/no-dynamic-delete - delete options[key]; - - expect(() => faker.date.birthdate(options)).toThrow( - new FakerError( - `The 'min', 'max', and 'mode' options must be set together.` - ) - ); - } - ); - it('should throw an error when the min > max year', () => { const min = 2000; const max = 1990; diff --git a/test/modules/finance.spec.ts b/test/modules/finance.spec.ts index 69bcc3d1..d325f1b7 100644 --- a/test/modules/finance.spec.ts +++ b/test/modules/finance.spec.ts @@ -83,18 +83,6 @@ describe('finance', () => { .it('with issuer option mastercard', { issuer: 'mastercard' }); }); - t.describe('maskedNumber', (t) => { - t.it('noArgs') - .it('with length', 5) - .it('with length option', { length: 5 }) - .it('with length and parenthesis option', { length: 5, parens: false }) - .it('with length, parenthesis and ellipsis option', { - length: 5, - parens: false, - ellipsis: true, - }); - }); - t.describe('bitcoinAddress', (t) => { t.it('noArgs') .it('with type option', { type: BitcoinAddressFamily.Legacy }) @@ -157,43 +145,6 @@ 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({ - parens: false, - ellipsis: false, - }); - - expect( - mask, - `The expected default mask length is ${expected} but it was ${mask.length}` - ).toHaveLength(expected); - }); - - it('should set a specified length', () => { - const expected = faker.number.int({ min: 1, max: 20 }); - - const mask = faker.finance.maskedNumber({ - length: expected, - parens: false, - ellipsis: false, - }); // the length of mask picks 4 if the random number generator picks 0 - - expect( - mask, - `The expected default mask length is ${expected} but it was ${mask.length}` - ).toHaveLength(expected); - }); - }); - describe('amount()', () => { it('should use the default amounts when not passing arguments', () => { const amount = faker.finance.amount(); diff --git a/test/modules/helpers-eval.spec.ts b/test/modules/helpers-eval.spec.ts index aef1492f..21df9975 100644 --- a/test/modules/helpers-eval.spec.ts +++ b/test/modules/helpers-eval.spec.ts @@ -124,18 +124,15 @@ describe('fakeEval()', () => { }); it('requires a function for parameters', () => { - // TODO @ST-DDT 2023-12-11: Replace in v10 - // expect(faker.definitions.person.first_name.generic).toBeDefined(); - //expect(() => fakeEval('person.first_name().generic', faker)).toThrow( - // new FakerError(`Cannot resolve expression 'person.first_name'`) - // ); - const actual = fakeEval('person.first_name().generic', faker); - expect(faker.definitions.person.first_name.generic ?? []).toContain(actual); + expect(faker.definitions.person.first_name.generic).toBeDefined(); + expect(() => fakeEval('person.first_name().generic', faker)).toThrow( + new FakerError("Cannot resolve expression 'person.first_name().generic'") + ); }); it('requires a valid expression (missing value)', () => { expect(() => fakeEval('foo.bar', faker)).toThrow( - new FakerError(`Cannot resolve expression 'foo.bar'`) + new FakerError("Cannot resolve expression 'foo.bar'") ); }); diff --git a/test/modules/helpers.spec.ts b/test/modules/helpers.spec.ts index 241e8f52..e987af2a 100644 --- a/test/modules/helpers.spec.ts +++ b/test/modules/helpers.spec.ts @@ -1120,17 +1120,6 @@ describe('helpers', () => { delete (faker.string as any).special; }); - it('should support deprecated module aliases', () => { - expect(faker.definitions.location.state).toContain( - faker.helpers.fake('{{address.state}}') - ); - expect([ - ...(faker.definitions.person.first_name.female ?? []), - ...(faker.definitions.person.first_name.generic ?? []), - ...(faker.definitions.person.first_name.male ?? []), - ]).toContain(faker.helpers.fake('{{name.firstName}}')); - }); - it('should not trim whitespace', () => { expect(faker.helpers.fake(' --- ')).toBe(' --- '); }); diff --git a/test/modules/image.spec.ts b/test/modules/image.spec.ts index 501a7a76..56fa0173 100644 --- a/test/modules/image.spec.ts +++ b/test/modules/image.spec.ts @@ -24,7 +24,7 @@ function assertValidUrl(address: string): void { describe('image', () => { seededTests(faker, 'image', (t) => { - t.itEach('avatar', 'avatarGitHub', 'avatarLegacy'); + t.itEach('avatar', 'avatarGitHub'); t.describe('url', (t) => { t.it('noArgs') @@ -61,33 +61,6 @@ describe('image', () => { }); }); - t.describe('urlPlaceholder', (t) => { - t.it('noArgs') - .it('with width', { width: 128 }) - .it('with height', { height: 128 }) - .it('with width and height', { width: 128, height: 128 }) - .it('with backgroundColor', { backgroundColor: 'FF0000' }) - .it('with textColor', { textColor: '0000FF' }) - .it('with format', { format: 'webp' }) - .it('with text', { text: 'Hello' }) - .it('with all options', { - width: 128, - height: 128, - backgroundColor: 'FF0000', - textColor: '0000FF', - format: 'png', - text: 'hello', - }) - .it('with empty colors and text', { - width: 128, - height: 128, - backgroundColor: '', - textColor: '', - format: 'png', - text: '', - }); - }); - t.describe('dataUri', (t) => { t.it('noArgs') .it('with width', { width: 128 }) @@ -137,19 +110,6 @@ describe('image', () => { }); }); - describe('avatarLegacy', () => { - it('should return a random avatar url from cloudflare-ipfs', () => { - const actual = faker.image.avatarLegacy(); - - expect(actual).toBeTypeOf('string'); - expect(actual).toMatch( - /^https:\/\/cloudflare-ipfs\.com\/ipfs\/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye\/avatar\/\d{1,4}\.jpg$/ - ); - // The links aren't working anymore - there is nothing we can do about it - // assertWebAddress(avatarUrl); - }); - }); - describe('personPortrait', () => { it('should return a random avatar url from AI', () => { const imageUrl = faker.image.personPortrait(); @@ -228,17 +188,6 @@ describe('image', () => { }); }); - describe('urlPlaceholder', () => { - it('should return a random image url from Placeholder', () => { - const actual = faker.image.urlPlaceholder(); - - assertValidUrl(actual); - expect(actual).toMatch( - /^https:\/\/via\.placeholder\.com\/\d+x\d+\/[0-9a-fA-F]{6}\/[0-9a-fA-F]{6}\.[a-z]{3,4}\?text=.+$/ - ); - }); - }); - describe('dataUri', () => { it('should return an image data uri', () => { const actual = faker.image.dataUri(); diff --git a/test/modules/internet.spec.ts b/test/modules/internet.spec.ts index e690761b..9dd2e39d 100644 --- a/test/modules/internet.spec.ts +++ b/test/modules/internet.spec.ts @@ -2,7 +2,6 @@ import { isEmail, isFQDN, isHexadecimal, - isHexColor, isIP, isJWT, isMACAddress, @@ -67,20 +66,6 @@ describe('internet', () => { }); }); - t.describe('userName', (t) => { - t.it('noArgs') - .it('with firstName option', { firstName: 'Jane' }) - .it('with lastName option', { lastName: 'Doe' }) - .it('with all option', { firstName: 'Jane', lastName: 'Doe' }) - .it('with Latin names', { firstName: 'Jane', lastName: 'Doe' }) - .it('with accented names', { firstName: 'Hélene', lastName: 'Müller' }) - .it('with Cyrillic names', { - firstName: 'Фёдор', - lastName: 'Достоевский', - }) - .it('with Chinese names', { firstName: '大羽', lastName: '陳' }); - }); - t.describe('username', (t) => { t.it('noArgs') .it('with firstName option', { firstName: 'Jane' }) @@ -133,18 +118,6 @@ describe('internet', () => { t.it('noArgs').it('with options', { types: ['clientError'] }); }); - t.describe('color', (t) => { - t.it('noArgs') - .it('with blueBase option', { blueBase: 100 }) - .it('with greenBase option', { greenBase: 100 }) - .it('with redBase option', { redBase: 100 }) - .it('with all options', { - redBase: 100, - blueBase: 100, - greenBase: 100, - }); - }); - t.describe('mac', (t) => { t.it('noArgs') .it('with separator', ':') @@ -381,71 +354,6 @@ describe('internet', () => { }); }); - describe('userName()', () => { - it('should return a random userName', () => { - const userName = faker.internet.userName(); - - expect(userName).toBeTruthy(); - expect(userName).toBeTypeOf('string'); - expect(userName).toMatch(/\w/); - }); - - it('should return a random userName with given firstName', () => { - const userName = faker.internet.userName({ firstName: 'Aiden' }); - - expect(userName).toBeTruthy(); - expect(userName).toBeTypeOf('string'); - expect(userName).toMatch(/\w/); - expect(userName).includes('Aiden'); - }); - - it('should return a random userName with given firstName and lastName', () => { - const userName = faker.internet.userName({ - firstName: 'Aiden', - lastName: 'Harann', - }); - - expect(userName).toBeTruthy(); - expect(userName).toBeTypeOf('string'); - expect(userName).includes('Aiden'); - expect(userName).includes('Harann'); - expect(userName).toMatch(/^Aiden[._]Harann\d*/); - }); - - it('should strip accents', () => { - const userName = faker.internet.userName({ - firstName: 'Adèle', - lastName: 'Smith', - }); - expect(userName).includes('Adele'); - expect(userName).includes('Smith'); - }); - - it('should transliterate Cyrillic', () => { - const userName = faker.internet.userName({ - firstName: 'Амос', - lastName: 'Васильев', - }); - expect(userName).includes('Amos'); - }); - - it('should provide a fallback for Chinese etc', () => { - const userName = faker.internet.userName({ - firstName: '大羽', - lastName: '陳', - }); - expect(userName).includes('hlzp8d'); - }); - - it('should provide a fallback special unicode characters', () => { - const userName = faker.internet.userName({ - firstName: '🐼', - lastName: '❤️', - }); - expect(userName).includes('2qt8'); - }); - }); - describe('username()', () => { it('should return a random username', () => { const username = faker.internet.username(); @@ -838,28 +746,6 @@ describe('internet', () => { }); }); - describe('color()', () => { - it('should return a random hex value', () => { - const color = faker.internet.color(); - - expect(color).toBeTruthy(); - expect(color).toBeTypeOf('string'); - expect(color).toSatisfy(isHexColor); - }); - - it('should return a random hex value with given values', () => { - const color = faker.internet.color({ - redBase: 100, - greenBase: 100, - blueBase: 100, - }); - - expect(color).toBeTruthy(); - expect(color).toBeTypeOf('string'); - expect(color).toSatisfy(isHexColor); - }); - }); - describe('mac()', () => { it('should return a random MAC address with 6 hexadecimal digits', () => { const mac = faker.internet.mac(); |
