aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramillwood <[email protected]>2023-11-19 03:31:05 -0500
committerGitHub <[email protected]>2023-11-19 09:31:05 +0100
commit0ee1c6751ec97e10ca1436d2b100b4acb1ac90ec (patch)
tree237effde94a1c61adb707065c195e73b6a78f35e
parentb8049d171086bce7b46eb617c88f44cfdd019e00 (diff)
downloadfaker-0ee1c6751ec97e10ca1436d2b100b4acb1ac90ec.tar.xz
faker-0ee1c6751ec97e10ca1436d2b100b4acb1ac90ec.zip
fix(internet): username method to return value that always includes… (#2506)
Co-authored-by: Austin Millwood <[email protected]>
-rw-r--r--src/modules/internet/index.ts61
-rw-r--r--test/modules/__snapshots__/git.spec.ts.snap54
-rw-r--r--test/modules/__snapshots__/internet.spec.ts.snap140
-rw-r--r--test/modules/internet.spec.ts23
4 files changed, 149 insertions, 129 deletions
diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts
index 8cc651a3..bdc84dd6 100644
--- a/src/modules/internet/index.ts
+++ b/src/modules/internet/index.ts
@@ -65,7 +65,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.email() // '[email protected]'
- * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
+ * faker.internet.email({ firstName: 'Jeanne'}) // '[email protected]'
+ * faker.internet.email({ firstName: 'Jeanne'}) // '[email protected]'
+ * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev', allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
@@ -107,7 +109,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.email() // '[email protected]'
- * faker.internet.email('Jeanne', 'Doe') // '[email protected]'
+ * faker.internet.email('Jeanne') // '[email protected]'
+ * faker.internet.email('Jeanne') // '[email protected]'
+ * faker.internet.email('Jeanne', 'Doe') // '[email protected]'
* faker.internet.email('Jeanne', 'Doe', 'example.fakerjs.dev') // '[email protected]'
* faker.internet.email('Jeanne', 'Doe', 'example.fakerjs.dev', { allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
@@ -145,7 +149,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.email() // '[email protected]'
- * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
+ * faker.internet.email({ firstName: 'Jeanne' }) // '[email protected]'
+ * faker.internet.email({ firstName: 'Jeanne' }) // '[email protected]'
+ * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev', allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
@@ -248,8 +254,8 @@ export class InternetModule extends ModuleBase {
}
const {
- firstName = this.faker.person.firstName(),
- lastName = legacyLastName ?? this.faker.person.lastName(),
+ firstName,
+ lastName = legacyLastName,
provider = legacyProvider ??
this.faker.helpers.arrayElement(
this.faker.definitions.internet.free_email
@@ -295,7 +301,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.exampleEmail() // '[email protected]'
- * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
+ * faker.internet.exampleEmail({ firstName: 'Jeanne' }) // '[email protected]'
+ * faker.internet.exampleEmail({ firstName: 'Jeanne' }) // '[email protected]'
+ * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe', allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
* @since 3.1.0
@@ -331,7 +339,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.exampleEmail() // '[email protected]'
- * faker.internet.exampleEmail('Jeanne', 'Doe') // '[email protected]'
+ * faker.internet.exampleEmail('Jeanne') // '[email protected]'
+ * faker.internet.exampleEmail('Jeanne') // '[email protected]'
+ * faker.internet.exampleEmail('Jeanne', 'Doe') // '[email protected]'
* faker.internet.exampleEmail('Jeanne', 'Doe', { allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
* @since 3.1.0
@@ -365,7 +375,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.exampleEmail() // '[email protected]'
- * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
+ * faker.internet.exampleEmail({ firstName: 'Jeanne' }) // '[email protected]'
+ * faker.internet.exampleEmail({ firstName: 'Jeanne' }) // '[email protected]'
+ * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe', allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
* @since 3.1.0
@@ -454,8 +466,8 @@ export class InternetModule extends ModuleBase {
}
const {
- firstName = this.faker.person.firstName(),
- lastName = legacyLastName ?? this.faker.person.lastName(),
+ firstName,
+ lastName = legacyLastName,
allowSpecialCharacters = legacyOptions?.allowSpecialCharacters ?? false,
} = options;
@@ -485,7 +497,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.userName() // 'Nettie_Zboncak40'
- * faker.internet.userName({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne98' - note surname is not used
+ * faker.internet.userName({ firstName: 'Jeanne' }) // 'Jeanne98'
+ * faker.internet.userName({ firstName: 'Jeanne' }) // 'Jeanne.Smith98'
+ * faker.internet.userName({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne_Doe98'
* faker.internet.userName({ firstName: 'John', lastName: 'Doe' }) // 'John.Doe'
* faker.internet.userName({ firstName: 'Hélene', lastName: 'Müller' }) // 'Helene_Muller11'
* faker.internet.userName({ firstName: 'Фёдор', lastName: 'Достоевский' }) // 'Fedor.Dostoevskii50'
@@ -520,7 +534,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.userName() // 'Nettie_Zboncak40'
- * faker.internet.userName('Jeanne', 'Doe') // 'Jeanne98' - note surname is not used
+ * faker.internet.userName('Jeanne') // 'Jeanne98'
+ * faker.internet.userName('Jeanne') // 'Jeanne.Smith98'
+ * faker.internet.userName('Jeanne', 'Doe') // 'Jeanne_Doe98'
* faker.internet.userName('John', 'Doe') // 'John.Doe'
* faker.internet.userName('Hélene', 'Müller') // 'Helene_Muller11'
* faker.internet.userName('Фёдор', 'Достоевский') // 'Fedor.Dostoevskii50'
@@ -546,7 +562,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.userName() // 'Nettie_Zboncak40'
- * faker.internet.userName({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne98' - note surname is not used
+ * faker.internet.userName({ firstName: 'Jeanne'}) // 'Jeanne98'
+ * faker.internet.userName({ firstName: 'Jeanne'}) // 'Jeanne.Smith98'
+ * faker.internet.userName({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne_Doe98'
* faker.internet.userName({ firstName: 'John', lastName: 'Doe' }) // 'John.Doe'
* faker.internet.userName({ firstName: 'Hélene', lastName: 'Müller' }) // 'Helene_Muller11'
* faker.internet.userName({ firstName: 'Фёдор', lastName: 'Достоевский' }) // 'Fedor.Dostoevskii50'
@@ -608,23 +626,24 @@ export class InternetModule extends ModuleBase {
const {
firstName = this.faker.person.firstName(),
lastName = legacyLastName ?? this.faker.person.lastName(),
+ lastName: hasLastName = legacyLastName,
} = options;
let result: string;
- switch (this.faker.number.int(2)) {
+ const strategy = this.faker.number.int(hasLastName ? 1 : 2);
+ const separator = this.faker.helpers.arrayElement(['.', '_']);
+ switch (strategy) {
case 0:
- result = `${firstName}${this.faker.number.int(99)}`;
+ result = `${firstName}${separator}${lastName}${this.faker.number.int(
+ 99
+ )}`;
break;
case 1:
- result =
- firstName + this.faker.helpers.arrayElement(['.', '_']) + lastName;
+ result = `${firstName}${separator}${lastName}`;
break;
case 2:
default:
- result = `${firstName}${this.faker.helpers.arrayElement([
- '.',
- '_',
- ])}${lastName}${this.faker.number.int(99)}`;
+ result = `${firstName}${this.faker.number.int(99)}`;
break;
}
diff --git a/test/modules/__snapshots__/git.spec.ts.snap b/test/modules/__snapshots__/git.spec.ts.snap
index 9e52bd15..2294d6fc 100644
--- a/test/modules/__snapshots__/git.spec.ts.snap
+++ b/test/modules/__snapshots__/git.spec.ts.snap
@@ -10,28 +10,28 @@ exports[`git > 42 > commitDate > with only string refDate 1`] = `"Tue Dec 31 15:
exports[`git > 42 > commitEntry > with only Date refDate 1`] = `
"commit be4abdd39321ad7d3fe01ffce404f4d6db0906bd
-Author: Gregg Beahan III <[email protected]>
-Date: Tue Dec 31 14:49:14 2019 +0100
+Author: Gregg.Beahan9 <[email protected]>
+Date: Tue Dec 31 00:24:08 2019 +0300
-    parse multi-byte sensor
+    connect auxiliary bus
"
`;
exports[`git > 42 > commitEntry > with only number refDate 1`] = `
"commit be4abdd39321ad7d3fe01ffce404f4d6db0906bd
-Author: Gregg Beahan III <[email protected]>
-Date: Tue Dec 31 14:49:14 2019 +0100
+Author: Gregg.Beahan9 <[email protected]>
+Date: Tue Dec 31 00:24:08 2019 +0300
-    parse multi-byte sensor
+    connect auxiliary bus
"
`;
exports[`git > 42 > commitEntry > with only string refDate 1`] = `
"commit be4abdd39321ad7d3fe01ffce404f4d6db0906bd
-Author: Gregg Beahan III <[email protected]>
-Date: Tue Dec 31 14:49:14 2019 +0100
+Author: Gregg.Beahan9 <[email protected]>
+Date: Tue Dec 31 00:24:08 2019 +0300
-    parse multi-byte sensor
+    connect auxiliary bus
"
`;
@@ -53,28 +53,28 @@ exports[`git > 1211 > commitDate > with only string refDate 1`] = `"Tue Dec 31 0
exports[`git > 1211 > commitEntry > with only Date refDate 1`] = `
"commit adb42f0e3f4a973fab0aeefce96dfcf49cd438df
-Author: Imani Anderson <[email protected]>
-Date: Tue Dec 31 10:07:32 2019 -0400
+Author: Imani.Anderson <[email protected]>
+Date: Tue Dec 31 18:36:59 2019 +0200
-    override wireless interface
+    copy digital feed
"
`;
exports[`git > 1211 > commitEntry > with only number refDate 1`] = `
"commit adb42f0e3f4a973fab0aeefce96dfcf49cd438df
-Author: Imani Anderson <[email protected]>
-Date: Tue Dec 31 10:07:32 2019 -0400
+Author: Imani.Anderson <[email protected]>
+Date: Tue Dec 31 18:36:59 2019 +0200
-    override wireless interface
+    copy digital feed
"
`;
exports[`git > 1211 > commitEntry > with only string refDate 1`] = `
"commit adb42f0e3f4a973fab0aeefce96dfcf49cd438df
-Author: Imani Anderson <[email protected]>
-Date: Tue Dec 31 10:07:32 2019 -0400
+Author: Imani.Anderson <[email protected]>
+Date: Tue Dec 31 18:36:59 2019 +0200
-    override wireless interface
+    copy digital feed
"
`;
@@ -96,28 +96,28 @@ exports[`git > 1337 > commitDate > with only string refDate 1`] = `"Tue Dec 31 1
exports[`git > 1337 > commitEntry > with only Date refDate 1`] = `
"commit c346ba075bd57f5a62b82d72af39cbbb07a98cba
-Author: Miss Friedrich Krajcik <[email protected]>
-Date: Tue Dec 31 04:18:56 2019 -0700
+Author: Miss Friedrich Krajcik <[email protected]>
+Date: Tue Dec 31 02:27:22 2019 +0100
-    reboot haptic capacitor
+    reboot neural pixel
"
`;
exports[`git > 1337 > commitEntry > with only number refDate 1`] = `
"commit c346ba075bd57f5a62b82d72af39cbbb07a98cba
-Author: Miss Friedrich Krajcik <[email protected]>
-Date: Tue Dec 31 04:18:56 2019 -0700
+Author: Miss Friedrich Krajcik <[email protected]>
+Date: Tue Dec 31 02:27:22 2019 +0100
-    reboot haptic capacitor
+    reboot neural pixel
"
`;
exports[`git > 1337 > commitEntry > with only string refDate 1`] = `
"commit c346ba075bd57f5a62b82d72af39cbbb07a98cba
-Author: Miss Friedrich Krajcik <[email protected]>
-Date: Tue Dec 31 04:18:56 2019 -0700
+Author: Miss Friedrich Krajcik <[email protected]>
+Date: Tue Dec 31 02:27:22 2019 +0100
-    reboot haptic capacitor
+    reboot neural pixel
"
`;
diff --git a/test/modules/__snapshots__/internet.spec.ts.snap b/test/modules/__snapshots__/internet.spec.ts.snap
index c8c6d8bb..488dd6a8 100644
--- a/test/modules/__snapshots__/internet.spec.ts.snap
+++ b/test/modules/__snapshots__/internet.spec.ts.snap
@@ -38,41 +38,41 @@ exports[`internet > 42 > domainSuffix 1`] = `"info"`;
exports[`internet > 42 > domainWord 1`] = `"hasty-sherbet"`;
-exports[`internet > 42 > email > noArgs 1`] = `"[email protected]"`;
+exports[`internet > 42 > email > noArgs 1`] = `"[email protected]"`;
-exports[`internet > 42 > email > with all options 1`] = `"[email protected]"`;
+exports[`internet > 42 > email > with all options 1`] = `"[email protected]"`;
-exports[`internet > 42 > email > with allowSpecialCharacters option 1`] = `"[email protected]"`;
+exports[`internet > 42 > email > with allowSpecialCharacters option 1`] = `"[email protected]"`;
-exports[`internet > 42 > email > with firstName option 1`] = `"[email protected]"`;
+exports[`internet > 42 > email > with firstName option 1`] = `"[email protected]"`;
-exports[`internet > 42 > email > with lastName option 1`] = `"[email protected]"`;
+exports[`internet > 42 > email > with lastName option 1`] = `"[email protected]"`;
-exports[`internet > 42 > email > with legacy names 1`] = `"[email protected]"`;
+exports[`internet > 42 > email > with legacy names 1`] = `"[email protected]"`;
-exports[`internet > 42 > email > with legacy names and provider 1`] = `"[email protected]"`;
+exports[`internet > 42 > email > with legacy names and provider 1`] = `"[email protected]"`;
-exports[`internet > 42 > email > with legacy provider 1`] = `"[email protected]"`;
+exports[`internet > 42 > email > with legacy provider 1`] = `"[email protected]"`;
-exports[`internet > 42 > email > with provider option 1`] = `"[email protected]"`;
+exports[`internet > 42 > email > with provider option 1`] = `"[email protected]"`;
exports[`internet > 42 > emoji > noArgs 1`] = `"🕸️"`;
exports[`internet > 42 > emoji > with options 1`] = `"🦔"`;
-exports[`internet > 42 > exampleEmail > noArgs 1`] = `"[email protected]"`;
+exports[`internet > 42 > exampleEmail > noArgs 1`] = `"[email protected]"`;
-exports[`internet > 42 > exampleEmail > with all options 1`] = `"[email protected]"`;
+exports[`internet > 42 > exampleEmail > with all options 1`] = `"[email protected]"`;
-exports[`internet > 42 > exampleEmail > with allowSpecialCharacters option 1`] = `"[email protected]"`;
+exports[`internet > 42 > exampleEmail > with allowSpecialCharacters option 1`] = `"[email protected]"`;
-exports[`internet > 42 > exampleEmail > with firstName option 1`] = `"[email protected]"`;
+exports[`internet > 42 > exampleEmail > with firstName option 1`] = `"[email protected]"`;
-exports[`internet > 42 > exampleEmail > with lastName option 1`] = `"[email protected]"`;
+exports[`internet > 42 > exampleEmail > with lastName option 1`] = `"[email protected]"`;
-exports[`internet > 42 > exampleEmail > with legacy names 1`] = `"[email protected]"`;
+exports[`internet > 42 > exampleEmail > with legacy names 1`] = `"[email protected]"`;
-exports[`internet > 42 > exampleEmail > with legacy names and options 1`] = `"[email protected]"`;
+exports[`internet > 42 > exampleEmail > with legacy names and options 1`] = `"[email protected]"`;
exports[`internet > 42 > httpMethod 1`] = `"POST"`;
@@ -124,23 +124,23 @@ exports[`internet > 42 > url > without slash appended and with http protocol 1`]
exports[`internet > 42 > userAgent 1`] = `"Mozilla/5.0 (X11; Linux x86_64; rv:15.1) Gecko/20100101 Firefox/15.1.7"`;
-exports[`internet > 42 > userName > noArgs 1`] = `"Garnet73"`;
+exports[`internet > 42 > userName > noArgs 1`] = `"Garnet_Wiegand77"`;
-exports[`internet > 42 > userName > with Chinese names 1`] = `"hlzp8d_tpv"`;
+exports[`internet > 42 > userName > with Chinese names 1`] = `"hlzp8d_tpv95"`;
-exports[`internet > 42 > userName > with Cyrillic names 1`] = `"Fedor_Dostoevskii"`;
+exports[`internet > 42 > userName > with Cyrillic names 1`] = `"Fedor_Dostoevskii95"`;
-exports[`internet > 42 > userName > with Latin names 1`] = `"Jane_Doe"`;
+exports[`internet > 42 > userName > with Latin names 1`] = `"Jane_Doe95"`;
-exports[`internet > 42 > userName > with accented names 1`] = `"Helene_Muller"`;
+exports[`internet > 42 > userName > with accented names 1`] = `"Helene_Muller95"`;
-exports[`internet > 42 > userName > with all option 1`] = `"Jane_Doe"`;
+exports[`internet > 42 > userName > with all option 1`] = `"Jane_Doe95"`;
-exports[`internet > 42 > userName > with firstName option 1`] = `"Jane.Schinner73"`;
+exports[`internet > 42 > userName > with firstName option 1`] = `"Jane73"`;
-exports[`internet > 42 > userName > with lastName option 1`] = `"Garnet_Doe18"`;
+exports[`internet > 42 > userName > with lastName option 1`] = `"Garnet_Doe"`;
-exports[`internet > 42 > userName > with legacy names 1`] = `"Jane_Doe"`;
+exports[`internet > 42 > userName > with legacy names 1`] = `"Jane_Doe95"`;
exports[`internet > 1211 > avatar 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1160.jpg"`;
@@ -180,41 +180,41 @@ exports[`internet > 1211 > domainSuffix 1`] = `"org"`;
exports[`internet > 1211 > domainWord 1`] = `"vicious-infrastructure"`;
-exports[`internet > 1211 > email > noArgs 1`] = `"[email protected]"`;
+exports[`internet > 1211 > email > noArgs 1`] = `"[email protected]"`;
-exports[`internet > 1211 > email > with all options 1`] = `"[email protected]"`;
+exports[`internet > 1211 > email > with all options 1`] = `"[email protected]"`;
-exports[`internet > 1211 > email > with allowSpecialCharacters option 1`] = `"[email protected]"`;
+exports[`internet > 1211 > email > with allowSpecialCharacters option 1`] = `"Jadyn^[email protected]"`;
-exports[`internet > 1211 > email > with firstName option 1`] = `"[email protected]"`;
+exports[`internet > 1211 > email > with firstName option 1`] = `"[email protected]"`;
-exports[`internet > 1211 > email > with lastName option 1`] = `"[email protected]"`;
+exports[`internet > 1211 > email > with lastName option 1`] = `"[email protected]"`;
-exports[`internet > 1211 > email > with legacy names 1`] = `"[email protected]"`;
+exports[`internet > 1211 > email > with legacy names 1`] = `"[email protected]"`;
-exports[`internet > 1211 > email > with legacy names and provider 1`] = `"[email protected]"`;
+exports[`internet > 1211 > email > with legacy names and provider 1`] = `"[email protected]"`;
-exports[`internet > 1211 > email > with legacy provider 1`] = `"[email protected]"`;
+exports[`internet > 1211 > email > with legacy provider 1`] = `"[email protected]"`;
-exports[`internet > 1211 > email > with provider option 1`] = `"[email protected]"`;
+exports[`internet > 1211 > email > with provider option 1`] = `"[email protected]"`;
exports[`internet > 1211 > emoji > noArgs 1`] = `"🇮🇸"`;
exports[`internet > 1211 > emoji > with options 1`] = `"🌲"`;
-exports[`internet > 1211 > exampleEmail > noArgs 1`] = `"[email protected]"`;
+exports[`internet > 1211 > exampleEmail > noArgs 1`] = `"[email protected]"`;
-exports[`internet > 1211 > exampleEmail > with all options 1`] = `"[email protected]"`;
+exports[`internet > 1211 > exampleEmail > with all options 1`] = `"[email protected]"`;
-exports[`internet > 1211 > exampleEmail > with allowSpecialCharacters option 1`] = `"[email protected]"`;
+exports[`internet > 1211 > exampleEmail > with allowSpecialCharacters option 1`] = `"Jadyn^[email protected]"`;
-exports[`internet > 1211 > exampleEmail > with firstName option 1`] = `"[email protected]"`;
+exports[`internet > 1211 > exampleEmail > with firstName option 1`] = `"[email protected]"`;
-exports[`internet > 1211 > exampleEmail > with lastName option 1`] = `"[email protected]"`;
+exports[`internet > 1211 > exampleEmail > with lastName option 1`] = `"[email protected]"`;
-exports[`internet > 1211 > exampleEmail > with legacy names 1`] = `"[email protected]"`;
+exports[`internet > 1211 > exampleEmail > with legacy names 1`] = `"[email protected]"`;
-exports[`internet > 1211 > exampleEmail > with legacy names and options 1`] = `"[email protected]"`;
+exports[`internet > 1211 > exampleEmail > with legacy names and options 1`] = `"[email protected]"`;
exports[`internet > 1211 > httpMethod 1`] = `"PATCH"`;
@@ -266,23 +266,23 @@ exports[`internet > 1211 > url > without slash appended and with http protocol 1
exports[`internet > 1211 > userAgent 1`] = `"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.3; Trident/4.0)"`;
-exports[`internet > 1211 > userName > noArgs 1`] = `"Tito.Trantow12"`;
+exports[`internet > 1211 > userName > noArgs 1`] = `"Tito12"`;
-exports[`internet > 1211 > userName > with Chinese names 1`] = `"hlzp8d.tpv89"`;
+exports[`internet > 1211 > userName > with Chinese names 1`] = `"hlzp8d.tpv"`;
-exports[`internet > 1211 > userName > with Cyrillic names 1`] = `"Fedor.Dostoevskii89"`;
+exports[`internet > 1211 > userName > with Cyrillic names 1`] = `"Fedor.Dostoevskii"`;
-exports[`internet > 1211 > userName > with Latin names 1`] = `"Jane.Doe89"`;
+exports[`internet > 1211 > userName > with Latin names 1`] = `"Jane.Doe"`;
-exports[`internet > 1211 > userName > with accented names 1`] = `"Helene.Muller89"`;
+exports[`internet > 1211 > userName > with accented names 1`] = `"Helene.Muller"`;
-exports[`internet > 1211 > userName > with all option 1`] = `"Jane.Doe89"`;
+exports[`internet > 1211 > userName > with all option 1`] = `"Jane.Doe"`;
-exports[`internet > 1211 > userName > with firstName option 1`] = `"Jane_Koelpin22"`;
+exports[`internet > 1211 > userName > with firstName option 1`] = `"Jane22"`;
-exports[`internet > 1211 > userName > with lastName option 1`] = `"Tito_Doe"`;
+exports[`internet > 1211 > userName > with lastName option 1`] = `"Tito_Doe77"`;
-exports[`internet > 1211 > userName > with legacy names 1`] = `"Jane.Doe89"`;
+exports[`internet > 1211 > userName > with legacy names 1`] = `"Jane.Doe"`;
exports[`internet > 1337 > avatar 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/327.jpg"`;
@@ -322,37 +322,37 @@ exports[`internet > 1337 > domainSuffix 1`] = `"biz"`;
exports[`internet > 1337 > domainWord 1`] = `"fair-mile"`;
-exports[`internet > 1337 > email > noArgs 1`] = `"[email protected]"`;
+exports[`internet > 1337 > email > noArgs 1`] = `"[email protected]"`;
-exports[`internet > 1337 > email > with all options 1`] = `"[email protected]"`;
+exports[`internet > 1337 > email > with all options 1`] = `"[email protected]"`;
-exports[`internet > 1337 > email > with allowSpecialCharacters option 1`] = `"[email protected]"`;
+exports[`internet > 1337 > email > with allowSpecialCharacters option 1`] = `"[email protected]"`;
-exports[`internet > 1337 > email > with firstName option 1`] = `"[email protected]"`;
+exports[`internet > 1337 > email > with firstName option 1`] = `"[email protected]"`;
-exports[`internet > 1337 > email > with lastName option 1`] = `"[email protected]"`;
+exports[`internet > 1337 > email > with lastName option 1`] = `"[email protected]"`;
exports[`internet > 1337 > email > with legacy names 1`] = `"[email protected]"`;
-exports[`internet > 1337 > email > with legacy names and provider 1`] = `"[email protected]"`;
+exports[`internet > 1337 > email > with legacy names and provider 1`] = `"[email protected]"`;
-exports[`internet > 1337 > email > with legacy provider 1`] = `"[email protected]"`;
+exports[`internet > 1337 > email > with legacy provider 1`] = `"[email protected]"`;
-exports[`internet > 1337 > email > with provider option 1`] = `"[email protected]"`;
+exports[`internet > 1337 > email > with provider option 1`] = `"[email protected]"`;
exports[`internet > 1337 > emoji > noArgs 1`] = `"💇🏼‍♀️"`;
exports[`internet > 1337 > emoji > with options 1`] = `"🐪"`;
-exports[`internet > 1337 > exampleEmail > noArgs 1`] = `"[email protected]"`;
+exports[`internet > 1337 > exampleEmail > noArgs 1`] = `"[email protected]"`;
exports[`internet > 1337 > exampleEmail > with all options 1`] = `"Jane&[email protected]"`;
-exports[`internet > 1337 > exampleEmail > with allowSpecialCharacters option 1`] = `"[email protected]"`;
+exports[`internet > 1337 > exampleEmail > with allowSpecialCharacters option 1`] = `"[email protected]"`;
-exports[`internet > 1337 > exampleEmail > with firstName option 1`] = `"[email protected]"`;
+exports[`internet > 1337 > exampleEmail > with firstName option 1`] = `"[email protected]"`;
-exports[`internet > 1337 > exampleEmail > with lastName option 1`] = `"[email protected]"`;
+exports[`internet > 1337 > exampleEmail > with lastName option 1`] = `"[email protected]"`;
exports[`internet > 1337 > exampleEmail > with legacy names 1`] = `"[email protected]"`;
@@ -408,20 +408,20 @@ exports[`internet > 1337 > url > without slash appended and with http protocol 1
exports[`internet > 1337 > userAgent 1`] = `"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.7.0; rv:6.2) Gecko/20100101 Firefox/6.2.2"`;
-exports[`internet > 1337 > userName > noArgs 1`] = `"Devyn27"`;
+exports[`internet > 1337 > userName > noArgs 1`] = `"Devyn.Cronin54"`;
-exports[`internet > 1337 > userName > with Chinese names 1`] = `"hlzp8d56"`;
+exports[`internet > 1337 > userName > with Chinese names 1`] = `"hlzp8d_tpv15"`;
-exports[`internet > 1337 > userName > with Cyrillic names 1`] = `"Fedor56"`;
+exports[`internet > 1337 > userName > with Cyrillic names 1`] = `"Fedor_Dostoevskii15"`;
-exports[`internet > 1337 > userName > with Latin names 1`] = `"Jane56"`;
+exports[`internet > 1337 > userName > with Latin names 1`] = `"Jane_Doe15"`;
-exports[`internet > 1337 > userName > with accented names 1`] = `"Helene56"`;
+exports[`internet > 1337 > userName > with accented names 1`] = `"Helene_Muller15"`;
-exports[`internet > 1337 > userName > with all option 1`] = `"Jane56"`;
+exports[`internet > 1337 > userName > with all option 1`] = `"Jane_Doe15"`;
-exports[`internet > 1337 > userName > with firstName option 1`] = `"Jane21"`;
+exports[`internet > 1337 > userName > with firstName option 1`] = `"Jane.MacGyver27"`;
exports[`internet > 1337 > userName > with lastName option 1`] = `"Devyn.Doe"`;
-exports[`internet > 1337 > userName > with legacy names 1`] = `"Jane56"`;
+exports[`internet > 1337 > userName > with legacy names 1`] = `"Jane_Doe15"`;
diff --git a/test/modules/internet.spec.ts b/test/modules/internet.spec.ts
index 40518833..be9aa025 100644
--- a/test/modules/internet.spec.ts
+++ b/test/modules/internet.spec.ts
@@ -252,9 +252,8 @@ describe('internet', () => {
const [prefix, suffix] = email.split('@');
expect(prefix).includes('Aiden');
- expect(prefix).toMatch(
- /^Aiden((\d{1,2})|([._]Harann\d{1,2})|([._](Harann)))/
- );
+ expect(prefix).includes('Harann');
+ expect(prefix).toMatch(/^Aiden[._]Harann\d*/);
expect(faker.definitions.internet.free_email).toContain(suffix);
});
@@ -296,9 +295,7 @@ describe('internet', () => {
const [prefix, suffix] = email.split('@');
- expect(prefix).toMatch(
- /^Mike((\d{1,2})|([.!#$%&'*+-/=?^_`{|}~]Smith\d{1,2})|([.!#$%&'*+-/=?^_`{|}~]Smith))/
- );
+ expect(prefix).toMatch(/^Mike[.!#$%&'*+-/=?^_`{|}~]Smith\d*/);
expect(faker.definitions.internet.free_email).toContain(suffix);
});
});
@@ -344,10 +341,12 @@ describe('internet', () => {
expect(email).toSatisfy(validator.isEmail);
const [prefix, suffix] = email.split('@');
+ expect(email).includes('Aiden');
+ expect(email).includes('Harann');
expect(suffix).toMatch(/^example\.(com|net|org)$/);
expect(faker.definitions.internet.example_email).toContain(suffix);
- expect(prefix).toMatch(/^Aiden([._]Harann)?\d*/);
+ expect(prefix).toMatch(/^Aiden[._]Harann\d*/);
});
it('should return an email with special characters', () => {
@@ -365,7 +364,9 @@ describe('internet', () => {
expect(suffix).toMatch(/^example\.(com|net|org)$/);
expect(faker.definitions.internet.example_email).toContain(suffix);
- expect(prefix).toMatch(/^Mike([.!#$%&'*+-/=?^_`{|}~]Smith)?\d*/);
+ expect(prefix).includes('Mike');
+ expect(prefix).includes('Smith');
+ expect(prefix).toMatch(/^Mike[.!#$%&'*+-/=?^_`{|}~]Smith\d*/);
});
});
@@ -396,9 +397,8 @@ describe('internet', () => {
expect(username).toBeTruthy();
expect(username).toBeTypeOf('string');
expect(username).includes('Aiden');
- expect(username).toMatch(
- /^Aiden((\d{1,2})|([._]Harann\d{1,2})|([._](Harann)))/
- );
+ expect(username).includes('Harann');
+ expect(username).toMatch(/^Aiden[._]Harann\d*/);
});
it('should strip accents', () => {
@@ -407,6 +407,7 @@ describe('internet', () => {
lastName: 'Smith',
});
expect(username).includes('Adele');
+ expect(username).includes('Smith');
});
it('should transliterate Cyrillic', () => {