From 0ee1c6751ec97e10ca1436d2b100b4acb1ac90ec Mon Sep 17 00:00:00 2001 From: amillwood <78274680+amillwood@users.noreply.github.com> Date: Sun, 19 Nov 2023 03:31:05 -0500 Subject: [PATCH] =?UTF-8?q?fix(internet):=20username=20method=20to=20retur?= =?UTF-8?q?n=20value=20that=20always=20includes=E2=80=A6=20(#2506)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Austin Millwood --- src/modules/internet/index.ts | 61 +++++--- test/modules/__snapshots__/git.spec.ts.snap | 54 +++---- .../__snapshots__/internet.spec.ts.snap | 140 +++++++++--------- test/modules/internet.spec.ts | 23 +-- 4 files changed, 149 insertions(+), 129 deletions(-) diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts index 8cc651a3fd7..bdc84dd6add 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() // 'Kassandra4@hotmail.com' - * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne63@yahoo.com' + * faker.internet.email({ firstName: 'Jeanne'}) // 'Jeanne63@yahoo.com' + * faker.internet.email({ firstName: 'Jeanne'}) // 'Jeanne_Smith63@yahoo.com' + * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne.Doe63@yahoo.com' * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev' }) // 'Jeanne_Doe88@example.fakerjs.dev' * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev', allowSpecialCharacters: true }) // 'Jeanne%Doe88@example.fakerjs.dev' * @@ -107,7 +109,9 @@ export class InternetModule extends ModuleBase { * * @example * faker.internet.email() // 'Kassandra4@hotmail.com' - * faker.internet.email('Jeanne', 'Doe') // 'Jeanne63@yahoo.com' + * faker.internet.email('Jeanne') // 'Jeanne63@yahoo.com' + * faker.internet.email('Jeanne') // 'Jeanne.Smith63@yahoo.com' + * faker.internet.email('Jeanne', 'Doe') // 'Jeanne_Doe63@yahoo.com' * faker.internet.email('Jeanne', 'Doe', 'example.fakerjs.dev') // 'Jeanne_Doe88@example.fakerjs.dev' * faker.internet.email('Jeanne', 'Doe', 'example.fakerjs.dev', { allowSpecialCharacters: true }) // 'Jeanne%Doe88@example.fakerjs.dev' * @@ -145,7 +149,9 @@ export class InternetModule extends ModuleBase { * * @example * faker.internet.email() // 'Kassandra4@hotmail.com' - * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne63@yahoo.com' + * faker.internet.email({ firstName: 'Jeanne' }) // 'Jeanne63@yahoo.com' + * faker.internet.email({ firstName: 'Jeanne' }) // 'Jeanne.Smith63@yahoo.com' + * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne_Doe63@yahoo.com' * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev' }) // 'Jeanne_Doe88@example.fakerjs.dev' * faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev', allowSpecialCharacters: true }) // 'Jeanne%Doe88@example.fakerjs.dev' * @@ -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() // 'Helmer.Graham23@example.com' - * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne96@example.net' + * faker.internet.exampleEmail({ firstName: 'Jeanne' }) // 'Jeanne96@example.net' + * faker.internet.exampleEmail({ firstName: 'Jeanne' }) // 'Jeanne.Smith96@example.net' + * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne_Doe96@example.net' * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe', allowSpecialCharacters: true }) // 'Jeanne%Doe88@example.com' * * @since 3.1.0 @@ -331,7 +339,9 @@ export class InternetModule extends ModuleBase { * * @example * faker.internet.exampleEmail() // 'Helmer.Graham23@example.com' - * faker.internet.exampleEmail('Jeanne', 'Doe') // 'Jeanne96@example.net' + * faker.internet.exampleEmail('Jeanne') // 'Jeanne96@example.net' + * faker.internet.exampleEmail('Jeanne') // 'Jeanne.Smith96@example.net' + * faker.internet.exampleEmail('Jeanne', 'Doe') // 'Jeanne_Doe96@example.net' * faker.internet.exampleEmail('Jeanne', 'Doe', { allowSpecialCharacters: true }) // 'Jeanne%Doe88@example.com' * * @since 3.1.0 @@ -365,7 +375,9 @@ export class InternetModule extends ModuleBase { * * @example * faker.internet.exampleEmail() // 'Helmer.Graham23@example.com' - * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne96@example.net' + * faker.internet.exampleEmail({ firstName: 'Jeanne' }) // 'Jeanne96@example.net' + * faker.internet.exampleEmail({ firstName: 'Jeanne' }) // 'Jeanne.Smith96@example.net' + * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // 'Jeanne_Doe96@example.net' * faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe', allowSpecialCharacters: true }) // 'Jeanne%Doe88@example.com' * * @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 9e52bd15e82..2294d6fcc5f 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 -Date: Tue Dec 31 14:49:14 2019 +0100 +Author: Gregg.Beahan9 +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 -Date: Tue Dec 31 14:49:14 2019 +0100 +Author: Gregg.Beahan9 +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 -Date: Tue Dec 31 14:49:14 2019 +0100 +Author: Gregg.Beahan9 +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 -Date: Tue Dec 31 10:07:32 2019 -0400 +Author: Imani.Anderson +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 -Date: Tue Dec 31 10:07:32 2019 -0400 +Author: Imani.Anderson +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 -Date: Tue Dec 31 10:07:32 2019 -0400 +Author: Imani.Anderson +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 -Date: Tue Dec 31 04:18:56 2019 -0700 +Author: Miss Friedrich Krajcik +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 -Date: Tue Dec 31 04:18:56 2019 -0700 +Author: Miss Friedrich Krajcik +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 -Date: Tue Dec 31 04:18:56 2019 -0700 +Author: Miss Friedrich Krajcik +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 c8c6d8bbc36..488dd6a873b 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`] = `"Garnet_Wiegand59@gmail.com"`; +exports[`internet > 42 > email > noArgs 1`] = `"Peyton59@yahoo.com"`; -exports[`internet > 42 > email > with all options 1`] = `"Jane_Doe@fakerjs.dev"`; +exports[`internet > 42 > email > with all options 1`] = `"Jane_Doe95@fakerjs.dev"`; -exports[`internet > 42 > email > with allowSpecialCharacters option 1`] = `"Garnet$Wiegand59@gmail.com"`; +exports[`internet > 42 > email > with allowSpecialCharacters option 1`] = `"Peyton59@yahoo.com"`; -exports[`internet > 42 > email > with firstName option 1`] = `"Jane73@hotmail.com"`; +exports[`internet > 42 > email > with firstName option 1`] = `"Jane_Wiegand77@yahoo.com"`; -exports[`internet > 42 > email > with lastName option 1`] = `"Garnet.Doe73@hotmail.com"`; +exports[`internet > 42 > email > with lastName option 1`] = `"Peyton.Doe@yahoo.com"`; -exports[`internet > 42 > email > with legacy names 1`] = `"Jane_Doe18@yahoo.com"`; +exports[`internet > 42 > email > with legacy names 1`] = `"Jane_Doe@yahoo.com"`; -exports[`internet > 42 > email > with legacy names and provider 1`] = `"Jane_Doe@fakerjs.dev"`; +exports[`internet > 42 > email > with legacy names and provider 1`] = `"Jane_Doe95@fakerjs.dev"`; -exports[`internet > 42 > email > with legacy provider 1`] = `"Garnet73@fakerjs.dev"`; +exports[`internet > 42 > email > with legacy provider 1`] = `"Garnet_Wiegand77@fakerjs.dev"`; -exports[`internet > 42 > email > with provider option 1`] = `"Garnet73@fakerjs.dev"`; +exports[`internet > 42 > email > with provider option 1`] = `"Garnet_Wiegand77@fakerjs.dev"`; exports[`internet > 42 > emoji > noArgs 1`] = `"🕸️"`; exports[`internet > 42 > emoji > with options 1`] = `"🦔"`; -exports[`internet > 42 > exampleEmail > noArgs 1`] = `"Garnet_Wiegand59@example.org"`; +exports[`internet > 42 > exampleEmail > noArgs 1`] = `"Peyton59@example.com"`; -exports[`internet > 42 > exampleEmail > with all options 1`] = `"Jane_Doe18@example.com"`; +exports[`internet > 42 > exampleEmail > with all options 1`] = `"Jane_Doe@example.com"`; -exports[`internet > 42 > exampleEmail > with allowSpecialCharacters option 1`] = `"Garnet$Wiegand59@example.org"`; +exports[`internet > 42 > exampleEmail > with allowSpecialCharacters option 1`] = `"Peyton59@example.com"`; -exports[`internet > 42 > exampleEmail > with firstName option 1`] = `"Jane73@example.net"`; +exports[`internet > 42 > exampleEmail > with firstName option 1`] = `"Jane_Wiegand77@example.com"`; -exports[`internet > 42 > exampleEmail > with lastName option 1`] = `"Garnet.Doe73@example.net"`; +exports[`internet > 42 > exampleEmail > with lastName option 1`] = `"Peyton.Doe@example.com"`; -exports[`internet > 42 > exampleEmail > with legacy names 1`] = `"Jane_Doe18@example.com"`; +exports[`internet > 42 > exampleEmail > with legacy names 1`] = `"Jane_Doe@example.com"`; -exports[`internet > 42 > exampleEmail > with legacy names and options 1`] = `"Jane_Doe18@example.com"`; +exports[`internet > 42 > exampleEmail > with legacy names and options 1`] = `"Jane_Doe@example.com"`; 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`] = `"Tito12@hotmail.com"`; +exports[`internet > 1211 > email > noArgs 1`] = `"Jadyn.Satterfield99@hotmail.com"`; -exports[`internet > 1211 > email > with all options 1`] = `"Jane.Doe89@fakerjs.dev"`; +exports[`internet > 1211 > email > with all options 1`] = `"Jane.Doe@fakerjs.dev"`; -exports[`internet > 1211 > email > with allowSpecialCharacters option 1`] = `"Tito12@hotmail.com"`; +exports[`internet > 1211 > email > with allowSpecialCharacters option 1`] = `"Jadyn^Satterfield99@hotmail.com"`; -exports[`internet > 1211 > email > with firstName option 1`] = `"Jane.Koelpin12@hotmail.com"`; +exports[`internet > 1211 > email > with firstName option 1`] = `"Jane12@hotmail.com"`; -exports[`internet > 1211 > email > with lastName option 1`] = `"Tito_Doe22@yahoo.com"`; +exports[`internet > 1211 > email > with lastName option 1`] = `"Jadyn_Doe@hotmail.com"`; -exports[`internet > 1211 > email > with legacy names 1`] = `"Jane_Doe@hotmail.com"`; +exports[`internet > 1211 > email > with legacy names 1`] = `"Jane_Doe77@hotmail.com"`; -exports[`internet > 1211 > email > with legacy names and provider 1`] = `"Jane.Doe89@fakerjs.dev"`; +exports[`internet > 1211 > email > with legacy names and provider 1`] = `"Jane.Doe@fakerjs.dev"`; -exports[`internet > 1211 > email > with legacy provider 1`] = `"Tito.Trantow12@fakerjs.dev"`; +exports[`internet > 1211 > email > with legacy provider 1`] = `"Tito12@fakerjs.dev"`; -exports[`internet > 1211 > email > with provider option 1`] = `"Tito.Trantow12@fakerjs.dev"`; +exports[`internet > 1211 > email > with provider option 1`] = `"Tito12@fakerjs.dev"`; exports[`internet > 1211 > emoji > noArgs 1`] = `"🇮🇸"`; exports[`internet > 1211 > emoji > with options 1`] = `"🌲"`; -exports[`internet > 1211 > exampleEmail > noArgs 1`] = `"Tito12@example.net"`; +exports[`internet > 1211 > exampleEmail > noArgs 1`] = `"Jadyn.Satterfield99@example.net"`; -exports[`internet > 1211 > exampleEmail > with all options 1`] = `"Jane_Doe@example.net"`; +exports[`internet > 1211 > exampleEmail > with all options 1`] = `"Jane_Doe77@example.net"`; -exports[`internet > 1211 > exampleEmail > with allowSpecialCharacters option 1`] = `"Tito12@example.net"`; +exports[`internet > 1211 > exampleEmail > with allowSpecialCharacters option 1`] = `"Jadyn^Satterfield99@example.net"`; -exports[`internet > 1211 > exampleEmail > with firstName option 1`] = `"Jane.Koelpin12@example.net"`; +exports[`internet > 1211 > exampleEmail > with firstName option 1`] = `"Jane12@example.net"`; -exports[`internet > 1211 > exampleEmail > with lastName option 1`] = `"Tito_Doe22@example.com"`; +exports[`internet > 1211 > exampleEmail > with lastName option 1`] = `"Jadyn_Doe@example.net"`; -exports[`internet > 1211 > exampleEmail > with legacy names 1`] = `"Jane_Doe@example.net"`; +exports[`internet > 1211 > exampleEmail > with legacy names 1`] = `"Jane_Doe77@example.net"`; -exports[`internet > 1211 > exampleEmail > with legacy names and options 1`] = `"Jane_Doe@example.net"`; +exports[`internet > 1211 > exampleEmail > with legacy names and options 1`] = `"Jane_Doe77@example.net"`; 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`] = `"Devyn54@gmail.com"`; +exports[`internet > 1337 > email > noArgs 1`] = `"Kellen_Effertz45@gmail.com"`; -exports[`internet > 1337 > email > with all options 1`] = `"Jane56@fakerjs.dev"`; +exports[`internet > 1337 > email > with all options 1`] = `"Jane_Doe15@fakerjs.dev"`; -exports[`internet > 1337 > email > with allowSpecialCharacters option 1`] = `"Devyn54@gmail.com"`; +exports[`internet > 1337 > email > with allowSpecialCharacters option 1`] = `"Kellen_Effertz45@gmail.com"`; -exports[`internet > 1337 > email > with firstName option 1`] = `"Jane27@gmail.com"`; +exports[`internet > 1337 > email > with firstName option 1`] = `"Jane.Cronin54@gmail.com"`; -exports[`internet > 1337 > email > with lastName option 1`] = `"Devyn21@yahoo.com"`; +exports[`internet > 1337 > email > with lastName option 1`] = `"Kellen.Doe27@gmail.com"`; exports[`internet > 1337 > email > with legacy names 1`] = `"Jane.Doe@gmail.com"`; -exports[`internet > 1337 > email > with legacy names and provider 1`] = `"Jane56@fakerjs.dev"`; +exports[`internet > 1337 > email > with legacy names and provider 1`] = `"Jane_Doe15@fakerjs.dev"`; -exports[`internet > 1337 > email > with legacy provider 1`] = `"Devyn27@fakerjs.dev"`; +exports[`internet > 1337 > email > with legacy provider 1`] = `"Devyn.Cronin54@fakerjs.dev"`; -exports[`internet > 1337 > email > with provider option 1`] = `"Devyn27@fakerjs.dev"`; +exports[`internet > 1337 > email > with provider option 1`] = `"Devyn.Cronin54@fakerjs.dev"`; exports[`internet > 1337 > emoji > noArgs 1`] = `"💇🏼‍♀️"`; exports[`internet > 1337 > emoji > with options 1`] = `"🐪"`; -exports[`internet > 1337 > exampleEmail > noArgs 1`] = `"Devyn54@example.org"`; +exports[`internet > 1337 > exampleEmail > noArgs 1`] = `"Kellen_Effertz45@example.org"`; exports[`internet > 1337 > exampleEmail > with all options 1`] = `"Jane&Doe@example.org"`; -exports[`internet > 1337 > exampleEmail > with allowSpecialCharacters option 1`] = `"Devyn54@example.org"`; +exports[`internet > 1337 > exampleEmail > with allowSpecialCharacters option 1`] = `"Kellen_Effertz45@example.org"`; -exports[`internet > 1337 > exampleEmail > with firstName option 1`] = `"Jane27@example.org"`; +exports[`internet > 1337 > exampleEmail > with firstName option 1`] = `"Jane.Cronin54@example.org"`; -exports[`internet > 1337 > exampleEmail > with lastName option 1`] = `"Devyn21@example.com"`; +exports[`internet > 1337 > exampleEmail > with lastName option 1`] = `"Kellen.Doe27@example.org"`; exports[`internet > 1337 > exampleEmail > with legacy names 1`] = `"Jane.Doe@example.org"`; @@ -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 40518833b7c..be9aa02588e 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', () => {