aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--docs/api/ApiIndex.vue7
-rw-r--r--docs/guide/frameworks.md4
-rw-r--r--src/faker.ts26
-rw-r--r--src/modules/date/index.ts27
-rw-r--r--src/modules/finance/index.ts166
-rw-r--r--src/modules/helpers/eval.ts24
-rw-r--r--src/modules/image/index.ts133
-rw-r--r--src/modules/internet/index.ts124
-rw-r--r--test/modules/__snapshots__/finance.spec.ts.snap30
-rw-r--r--test/modules/__snapshots__/image.spec.ts.snap66
-rw-r--r--test/modules/__snapshots__/internet.spec.ts.snap78
-rw-r--r--test/modules/date.spec.ts16
-rw-r--r--test/modules/finance.spec.ts49
-rw-r--r--test/modules/helpers-eval.spec.ts13
-rw-r--r--test/modules/helpers.spec.ts11
-rw-r--r--test/modules/image.spec.ts53
-rw-r--r--test/modules/internet.spec.ts114
-rw-r--r--test/scripts/apidocs/__snapshots__/verify-jsdoc-tags.spec.ts.snap5
-rw-r--r--test/scripts/apidocs/verify-jsdoc-tags.spec.ts5
20 files changed, 14 insertions, 939 deletions
diff --git a/README.md b/README.md
index 0073adae..f05e0c48 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@ const { faker } = require('@faker-js/faker');
export function createRandomUser() {
return {
userId: faker.string.uuid(),
- username: faker.internet.username(), // before version 9.1.0, use userName()
+ username: faker.internet.username(),
email: faker.internet.email(),
avatar: faker.image.avatar(),
password: faker.internet.password(),
diff --git a/docs/api/ApiIndex.vue b/docs/api/ApiIndex.vue
index 94085371..7b1be7bf 100644
--- a/docs/api/ApiIndex.vue
+++ b/docs/api/ApiIndex.vue
@@ -69,13 +69,8 @@ const filtered = computed(() => {
</h3>
<ul>
<li v-for="h of item.headers" :key="h.anchor">
- <!-- TODO @ST-DDT 2024-09-25: Remove this in v10 -->
<a
- :href="
- item.link +
- '#' +
- (h.anchor === 'userName' ? 'username-1' : slugify(h.anchor))
- "
+ :href="item.link + '#' + slugify(h.anchor)"
:class="{ deprecated: h.deprecated }"
>{{ h.text }}</a
>
diff --git a/docs/guide/frameworks.md b/docs/guide/frameworks.md
index 1733b4e1..ded22f9c 100644
--- a/docs/guide/frameworks.md
+++ b/docs/guide/frameworks.md
@@ -71,7 +71,7 @@ import { faker } from '@faker-js/faker/locale/en';
describe('Testing the application', () => {
it('should create an account with username and password', () => {
- let username = faker.internet.username(); // before version 9.1.0, use userName()
+ let username = faker.internet.username();
let password = faker.internet.password();
let email = faker.internet.exampleEmail();
@@ -111,7 +111,7 @@ test.describe('Testing the application', () => {
test('should create an account with username and password', async ({
page,
}) => {
- const username = faker.internet.username(); // before version 9.1.0, use userName()
+ const username = faker.internet.username();
const password = faker.internet.password();
const email = faker.internet.exampleEmail();
diff --git a/src/faker.ts b/src/faker.ts
index d9e9905b..cac89a32 100644
--- a/src/faker.ts
+++ b/src/faker.ts
@@ -1,6 +1,5 @@
import type { LocaleDefinition, MetadataDefinition } from './definitions';
import { FakerError } from './errors/faker-error';
-import { deprecated } from './internal/deprecated';
import type { LocaleProxy } from './internal/locale-proxy';
import { createLocaleProxy } from './internal/locale-proxy';
import { AirlineModule } from './modules/airline';
@@ -18,11 +17,9 @@ import { HackerModule } from './modules/hacker';
import { HelpersModule } from './modules/helpers';
import { ImageModule } from './modules/image';
import { InternetModule } from './modules/internet';
-import type { LocationModule as AddressModule } from './modules/location';
import { LocationModule } from './modules/location';
import { LoremModule } from './modules/lorem';
import { MusicModule } from './modules/music';
-import type { PersonModule as NameModule } from './modules/person';
import { PersonModule } from './modules/person';
import { PhoneModule } from './modules/phone';
import { ScienceModule } from './modules/science';
@@ -87,29 +84,6 @@ export class Faker extends SimpleFaker {
readonly vehicle: VehicleModule = new VehicleModule(this);
readonly word: WordModule = new WordModule(this);
- // Aliases
- /** @deprecated Use {@link Faker#location} instead */
- get address(): AddressModule {
- deprecated({
- deprecated: 'faker.address',
- proposed: 'faker.location',
- since: '8.0',
- until: '10.0',
- });
- return this.location;
- }
-
- /** @deprecated Use {@link Faker#person} instead */
- get name(): NameModule {
- deprecated({
- deprecated: 'faker.name',
- proposed: 'faker.person',
- since: '8.0',
- until: '10.0',
- });
- return this.person;
- }
-
/**
* Creates a new instance of Faker.
*
diff --git a/src/modules/date/index.ts b/src/modules/date/index.ts
index 65d4a7d9..f1225cdb 100644
--- a/src/modules/date/index.ts
+++ b/src/modules/date/index.ts
@@ -160,13 +160,6 @@ export class SimpleDateModule extends SimpleModuleBase {
*/
to: string | Date | number;
}): Date {
- // TODO @matthewmayer 2023-03-27: Consider removing in v10 as this check is only needed in JS
- if (options == null || options.from == null || options.to == null) {
- throw new FakerError(
- 'Must pass an options object with `from` and `to` values.'
- );
- }
-
const { from, to } = options;
const fromMs = toDate(from, 'from').getTime();
@@ -234,13 +227,6 @@ export class SimpleDateModule extends SimpleModuleBase {
max: number;
};
}): Date[] {
- // TODO @matthewmayer 2023-03-27: Consider removing in v10 as this check is only needed in JS
- if (options == null || options.from == null || options.to == null) {
- throw new FakerError(
- 'Must pass an options object with `from` and `to` values.'
- );
- }
-
const { from, to, count = 3 } = options;
return this.faker.helpers
.multiple(() => this.between({ from, to }), { count })
@@ -486,21 +472,8 @@ export class SimpleDateModule extends SimpleModuleBase {
min = 18,
max = 80,
refDate: rawRefDate = this.faker.defaultRefDate(),
- mode: originalMode,
- min: originalMin,
- max: originalMax,
} = options;
- // TODO @ST-DDT 2024-03-17: Remove check in v10
- const optionsSet = [originalMin, originalMax, originalMode].filter(
- (x) => x != null
- ).length;
- if (optionsSet % 3 !== 0) {
- throw new FakerError(
- "The 'min', 'max', and 'mode' options must be set together."
- );
- }
-
const refDate = toDate(rawRefDate);
const refYear = refDate.getUTCFullYear();
diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts
index 414d07ee..9744ee6f 100644
--- a/src/modules/finance/index.ts
+++ b/src/modules/finance/index.ts
@@ -1,5 +1,4 @@
import { FakerError } from '../../errors/faker-error';
-import { deprecated } from '../../internal/deprecated';
import { ModuleBase } from '../../internal/module-base';
import type { BitcoinAddressFamilyType, BitcoinNetworkType } from './bitcoin';
import {
@@ -207,171 +206,6 @@ export class FinanceModule extends ModuleBase {
}
/**
- * Generates a random masked number.
- *
- * @param length The length of the unmasked number. Defaults to `4`.
- *
- * @example
- * faker.finance.maskedNumber() // '(...9711)'
- * faker.finance.maskedNumber(3) // '(...342)'
- *
- * @since 8.0.0
- *
- * @deprecated Use `faker.finance.iban().replace(/(?<=.{4})\w(?=.{2})/g, '*')` or a similar approach instead.
- */
- maskedNumber(length?: number): string;
- /**
- * Generates a random masked number.
- *
- * @param options An options object.
- * @param options.length The length of the unmasked number. Defaults to `4`.
- * @param options.parens Whether to use surrounding parenthesis. Defaults to `true`.
- * @param options.ellipsis Whether to prefix the numbers with an ellipsis. Defaults to `true`.
- *
- * @example
- * faker.finance.maskedNumber() // '(...9711)'
- * faker.finance.maskedNumber({ length: 3 }) // '(...342)'
- * faker.finance.maskedNumber({ length: 3, parens: false }) // '...236'
- * faker.finance.maskedNumber({ length: 3, parens: false, ellipsis: false }) // '298'
- *
- * @since 8.0.0
- *
- * @deprecated Use `faker.finance.iban().replace(/(?<=.{4})\w(?=.{2})/g, '*')` or a similar approach instead.
- */
- maskedNumber(options?: {
- /**
- * The length of the unmasked number.
- *
- * @default 4
- */
- length?: number;
- /**
- * Whether to use surrounding parenthesis.
- *
- * @default true
- */
- parens?: boolean;
- /**
- * Whether to prefix the numbers with an ellipsis.
- *
- * @default true
- */
- ellipsis?: boolean;
- }): string;
- /**
- * Generates a random masked number.
- *
- * @param optionsOrLength An options object or the length of the unmask number.
- * @param optionsOrLength.length The length of the unmasked number. Defaults to `4`.
- * @param optionsOrLength.parens Whether to use surrounding parenthesis. Defaults to `true`.
- * @param optionsOrLength.ellipsis Whether to prefix the numbers with an ellipsis. Defaults to `true`.
- *
- * @example
- * faker.finance.maskedNumber() // '(...9711)'
- * faker.finance.maskedNumber(3) // '(...342)'
- * faker.finance.maskedNumber({ length: 3 }) // '(...342)'
- * faker.finance.maskedNumber({ length: 3, parens: false }) // '...236'
- * faker.finance.maskedNumber({ length: 3, parens: false, ellipsis: false }) // '298'
- *
- * @since 8.0.0
- *
- * @deprecated Use `faker.finance.iban().replace(/(?<=.{4})\w(?=.{2})/g, '*')` or a similar approach instead.
- */
- maskedNumber(
- optionsOrLength?:
- | number
- | {
- /**
- * The length of the unmasked number.
- *
- * @default 4
- */
- length?: number;
- /**
- * Whether to use surrounding parenthesis.
- *
- * @default true
- */
- parens?: boolean;
- /**
- * Whether to prefix the numbers with an ellipsis.
- *
- * @default true
- */
- ellipsis?: boolean;
- }
- ): string;
- /**
- * Generates a random masked number.
- *
- * @param options An options object.
- * @param options.length The length of the unmasked number. Defaults to `4`.
- * @param options.parens Whether to use surrounding parenthesis. Defaults to `true`.
- * @param options.ellipsis Whether to prefix the numbers with an ellipsis. Defaults to `true`.
- *
- * @example
- * faker.finance.maskedNumber() // '(...9711)'
- * faker.finance.maskedNumber(3) // '(...342)'
- * faker.finance.maskedNumber({ length: 3 }) // '(...342)'
- * faker.finance.maskedNumber({ length: 3, parens: false }) // '...236'
- * faker.finance.maskedNumber({ length: 3, parens: false, ellipsis: false }) // '298'
- *
- * @since 8.0.0
- *
- * @deprecated Use `faker.finance.iban().replace(/(?<=.{4})\w(?=.{2})/g, '*')` or a similar approach instead.
- */
- maskedNumber(
- options:
- | number
- | {
- /**
- * The length of the unmasked number.
- *
- * @default 4
- */
- length?: number;
- /**
- * Whether to use surrounding parenthesis.
- *
- * @default true
- */
- parens?: boolean;
- /**
- * Whether to prefix the numbers with an ellipsis.
- *
- * @default true
- */
- ellipsis?: boolean;
- } = {}
- ): string {
- deprecated({
- deprecated: 'faker.finance.maskedNumber()',
- proposed:
- "faker.finance.iban().replace(/(?<=.{4})\\w(?=.{2})/g, '*') or a similar approach",
- since: '9.3.0',
- until: '10.0.0',
- });
-
- if (typeof options === 'number') {
- options = { length: options };
- }
-
- const { ellipsis = true, length = 4, parens = true } = options;
-
- let template = this.faker.string.numeric({ length });
-
- if (ellipsis) {
- template = `...${template}`;
- }
-
- if (parens) {
- template = `(${template})`;
- }
-
- return template;
- }
-
- /**
* Generates a random amount between the given bounds (inclusive).
*
* @param options An options object.
diff --git a/src/modules/helpers/eval.ts b/src/modules/helpers/eval.ts
index e04575bc..739f5af8 100644
--- a/src/modules/helpers/eval.ts
+++ b/src/modules/helpers/eval.ts
@@ -81,7 +81,7 @@ export function fakeEval(
do {
let index: number;
if (remaining.startsWith('(')) {
- [index, current] = evalProcessFunction(remaining, current, expression);
+ [index, current] = evalProcessFunction(remaining, current);
} else {
[index, current] = evalProcessExpression(remaining, current);
}
@@ -109,12 +109,10 @@ export function fakeEval(
*
* @param input The input string to parse.
* @param entrypoints The entrypoints to attempt the call on.
- * @param expression The full expression to use in errors.
*/
function evalProcessFunction(
input: string,
- entrypoints: ReadonlyArray<unknown>,
- expression: string
+ entrypoints: ReadonlyArray<unknown>
): [continueIndex: number, mapped: unknown[]] {
const [index, params] = findParams(input);
const nextChar = input[index + 1];
@@ -135,23 +133,7 @@ function evalProcessFunction(
return [
index + (nextChar === '.' ? 2 : 1), // one for the closing bracket, one for the dot
entrypoints.map((entrypoint): unknown =>
- // TODO @ST-DDT 2023-12-11: Replace in v10
- // typeof entrypoint === 'function' ? entrypoint(...params) : undefined
- {
- if (typeof entrypoint === 'function') {
- return entrypoint(...params);
- }
-
- // eslint-disable-next-line no-undef
- console.warn(
- `[@faker-js/faker]: Invoking expressions which are not functions is deprecated since v9.0 and will be removed in v10.0.
-Please remove the parentheses or replace the expression with an actual function.
-${expression}
-${' '.repeat(expression.length - input.length)}^`
- );
-
- return entrypoint;
- }
+ typeof entrypoint === 'function' ? entrypoint(...params) : undefined
),
];
}
diff --git a/src/modules/image/index.ts b/src/modules/image/index.ts
index ae4d76fe..61442dfe 100644
--- a/src/modules/image/index.ts
+++ b/src/modules/image/index.ts
@@ -1,5 +1,4 @@
import { toBase64 } from '../../internal/base64';
-import { deprecated } from '../../internal/deprecated';
import { ModuleBase } from '../../internal/module-base';
import type { SexType } from '../person';
@@ -10,7 +9,7 @@ import type { SexType } from '../person';
*
* For a random image, use [`url()`](https://fakerjs.dev/api/image.html#url). This will not return the image directly but a URL pointing to an image from one of two demo image providers "Picsum" and "LoremFlickr". You can request an image specifically from one of two providers using [`urlLoremFlickr()`](https://fakerjs.dev/api/image.html#urlloremflickr) or [`urlPicsumPhotos()`](https://fakerjs.dev/api/image.html#urlpicsumphotos).
*
- * For a random placeholder image containing only solid color and text, use [`urlPlaceholder()`](https://fakerjs.dev/api/image.html#urlplaceholder) (uses a third-party service) or [`dataUri()`](https://fakerjs.dev/api/image.html#datauri) (returns a SVG string).
+ * For a random placeholder image containing only solid color and text, use [`dataUri()`](https://fakerjs.dev/api/image.html#datauri) (returns a SVG string).
*
* For a random user avatar image, use [`avatar()`](https://fakerjs.dev/api/image.html#avatar), or [`personPortrait()`](https://fakerjs.dev/api/image.html#personportrait) which has more control over the size and sex of the person.
*
@@ -94,32 +93,6 @@ export class ImageModule extends ModuleBase {
}
/**
- * Generates a random avatar from `https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar`.
- *
- * @remark This method generates a random string representing an URL from cloudflare-ipfs. Faker is not responsible for the content of the image or the service providing it.
- *
- * @example
- * faker.image.avatarLegacy()
- * // 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/170.jpg'
- *
- * @since 8.0.0
- *
- * @deprecated The links are no longer working. Use `avatar()` instead.
- */
- avatarLegacy(): string {
- deprecated({
- deprecated: 'faker.image.avatarLegacy()',
- proposed: 'faker.image.avatar() or faker.image.personPortrait()',
- since: '9.0.2',
- until: '10.0.0',
- });
-
- return `https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/${this.faker.number.int(
- 1249
- )}.jpg`;
- }
-
- /**
* Generates a random image url.
*
* @remark This method generates a random string representing an URL from loremflickr. Faker is not responsible for the content of the image or the service providing it.
@@ -294,110 +267,6 @@ export class ImageModule extends ModuleBase {
}
/**
- * Generates a random image url provided via https://via.placeholder.com/.
- *
- * @remark This method generates a random string representing an URL from via.placeholder. Faker is not responsible for the content of the image or the service providing it.
- *
- * @param options Options for generating a URL for an image.
- * @param options.width The width of the image. Defaults to a random number between 1 and 3500.
- * @param options.height The height of the image. Defaults to a random number between 1 and 3500.
- * @param options.backgroundColor The background color of the image. Defaults to a random hex color.
- * @param options.textColor The text color of the image. Defaults to a random hex color.
- * @param options.format The format of the image. Defaults to a random format.
- * @param options.text The text to display on the image. Defaults to a random string.
- *
- * @example
- * faker.image.urlPlaceholder() // 'https://via.placeholder.com/150x180/FF0000/FFFFFF.webp?text=lorem'
- * faker.image.urlPlaceholder({ width: 128 }) // 'https://via.placeholder.com/128x180/FF0000/FFFFFF.webp?text=lorem'
- * faker.image.urlPlaceholder({ height: 128 }) // 'https://via.placeholder.com/150x128/FF0000/FFFFFF.webp?text=lorem'
- * faker.image.urlPlaceholder({ backgroundColor: '000000' }) // 'https://via.placeholder.com/150x180/000000/FFFFFF.webp?text=lorem'
- * faker.image.urlPlaceholder({ textColor: '000000' }) // 'https://via.placeholder.com/150x180/FF0000/000000.webp?text=lorem'
- * faker.image.urlPlaceholder({ format: 'png' }) // 'https://via.placeholder.com/150x180/FF0000/FFFFFF.png?text=lorem'
- * faker.image.urlPlaceholder({ text: 'lorem ipsum' }) // 'https://via.placeholder.com/150x180/FF0000/FFFFFF.webp?text=lorem+ipsum'
- * faker.image.urlPlaceholder({ width: 128, height: 128, backgroundColor: '000000', textColor: 'FF0000', format: 'png', text: 'lorem ipsum' }) // 'https://via.placeholder.com/128x128/000000/FF0000.png?text=lorem+ipsum'
- *
- * @since 8.0.0
- *
- * @deprecated The service has bad uptime. Use `faker.image.url()` or `faker.image.dataUri()` instead.
- */
- urlPlaceholder(
- options: {
- /**
- * The width of the image.
- *
- * @default faker.number.int({ min: 1, max: 3500 })
- */
- width?: number;
- /**
- * The height of the image.
- *
- * @default faker.number.int({ min: 1, max: 3500 })
- */
- height?: number;
- /**
- * The background color of the image.
- *
- * @default faker.color.rgb({ format: 'hex', prefix: '' })
- */
- backgroundColor?: string;
- /**
- * The text color of the image.
- *
- * @default faker.color.rgb({ format: 'hex', prefix: '' })
- */
- textColor?: string;
- /**
- * The format of the image.
- *
- * @default faker.helpers.arrayElement(['gif', 'jpeg', 'jpg', 'png', 'webp'])
- */
- format?: 'gif' | 'jpeg' | 'jpg' | 'png' | 'webp';
- /**
- * The text to display on the image.
- *
- * @default faker.lorem.words()
- */
- text?: string;
- } = {}
- ): string {
- deprecated({
- deprecated: 'faker.image.urlPlaceholder()',
- proposed: 'faker.image.url() or faker.image.dataUri()',
- since: '9.4.0',
- until: '10.0.0',
- });
-
- const {
- width = this.faker.number.int({ min: 1, max: 3500 }),
- height = this.faker.number.int({ min: 1, max: 3500 }),
- backgroundColor = this.faker.color.rgb({ format: 'hex', prefix: '' }),
- textColor = this.faker.color.rgb({ format: 'hex', prefix: '' }),
- format = this.faker.helpers.arrayElement([
- 'gif',
- 'jpeg',
- 'jpg',
- 'png',
- 'webp',
- ]),
- text = this.faker.lorem.words(),
- } = options;
-
- let url = `https://via.placeholder.com`;
-
- url += `/${width}`;
- url += `x${height}`;
-
- url += `/${backgroundColor}`;
- url += `/${textColor}`;
-
- url += `.${format}`;
-
- url += `?text=${encodeURIComponent(text)}`;
-
- return url;
- }
-
- /**
* Generates a random data uri containing an URL-encoded SVG image or a Base64-encoded SVG image.
*
* @param options Options for generating a data uri.
diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts
index afad6d39..2afdef39 100644
--- a/src/modules/internet/index.ts
+++ b/src/modules/internet/index.ts
@@ -1,7 +1,6 @@
import { FakerError } from '../../errors/faker-error';
import type { Faker } from '../../faker';
import { toBase64Url } from '../../internal/base64';
-import { deprecated } from '../../internal/deprecated';
import { ModuleBase } from '../../internal/module-base';
import { charMapping } from './char-mappings';
@@ -135,18 +134,6 @@ function makeValidDomainWordSlug(faker: Faker, word: string): string {
}
/**
- * Generates a random color in hex format with the given base color.
- *
- * @param faker The faker instance to use.
- * @param base The base color to use.
- */
-function colorFromBase(faker: Faker, base: number): string {
- return Math.floor((faker.number.int(256) + base) / 2)
- .toString(16)
- .padStart(2, '0');
-}
-
-/**
* Module to generate internet related entries.
*
* ### Overview
@@ -309,58 +296,6 @@ export class InternetModule extends ModuleBase {
* @see faker.internet.displayName(): For generating an Unicode display name.
*
* @example
- * faker.internet.userName() // 'Nettie_Zboncak40'
- * 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'
- * faker.internet.userName({ firstName: '大羽', lastName: '陳' }) // 'hlzp8d.tpv45' - note neither name is used
- *
- * @since 2.0.1
- *
- * @deprecated Use `faker.internet.username()` instead.
- */
- userName(
- options: {
- /**
- * The optional first name to use.
- *
- * @default faker.person.firstName()
- */
- firstName?: string;
- /**
- * The optional last name to use.
- *
- * @default faker.person.lastName()
- */
- lastName?: string;
- } = {}
- ): string {
- deprecated({
- deprecated: 'faker.internet.userName()',
- proposed: 'faker.internet.username()',
- since: '9.1.0',
- until: '10.0.0',
- });
-
- return this.username(options);
- }
-
- /**
- * Generates a username using the given person's name as base.
- * The resulting username may use neither, one or both of the names provided.
- * This will always return a plain ASCII string.
- * Some basic stripping of accents and transliteration of characters will be done.
- *
- * @param options An options object.
- * @param options.firstName The optional first name to use. If not specified, a random one will be chosen.
- * @param options.lastName The optional last name to use. If not specified, a random one will be chosen.
- *
- * @see faker.internet.displayName(): For generating an Unicode display name.
- *
- * @example
* faker.internet.username() // 'Nettie_Zboncak40'
* faker.internet.username({ firstName: 'Jeanne' }) // 'Jeanne98'
* faker.internet.username({ firstName: 'Jeanne' }) // 'Jeanne.Smith98'
@@ -807,65 +742,6 @@ export class InternetModule extends ModuleBase {
}
/**
- * Generates a random css hex color code in aesthetically pleasing color palette.
- *
- * Based on
- * http://stackoverflow.com/questions/43044/algorithm-to-randomly-generate-an-aesthetically-pleasing-color-palette
- *
- * @param options An options object.
- * @param options.redBase The optional base red in range between `0` and `255`. Defaults to `0`.
- * @param options.greenBase The optional base green in range between `0` and `255`. Defaults to `0`.
- * @param options.blueBase The optional base blue in range between `0` and `255`. Defaults to `0`.
- *
- * @see faker.color.rgb(): For generating a random RGB color.
- *
- * @example
- * faker.internet.color() // '#30686e'
- * faker.internet.color({ redBase: 100, greenBase: 100, blueBase: 100 }) // '#4e5f8b'
- *
- * @since 2.0.1
- *
- * @deprecated Please use faker.color.rgb() or any of the other color methods instead.
- */
- color(
- options: {
- /**
- * The optional base red in range between `0` and `255`.
- *
- * @default 0
- */
- redBase?: number;
- /**
- * The optional base green in range between `0` and `255`.
- *
- * @default 0
- */
- greenBase?: number;
- /**
- * The optional base blue in range between `0` and `255`.
- *
- * @default 0
- */
- blueBase?: number;
- } = {}
- ): string {
- deprecated({
- deprecated: 'faker.internet.color()',
- proposed: 'faker.color.rgb()',
- since: '9.6.0',
- until: '10.0.0',
- });
-
- const { redBase = 0, greenBase = 0, blueBase = 0 } = options;
-
- const red = colorFromBase(this.faker, redBase);
- const green = colorFromBase(this.faker, greenBase);
- const blue = colorFromBase(this.faker, blueBase);
-
- return `#${red}${green}${blue}`;
- }
-
- /**
* Generates a random mac address.
*
* @param options An options object.
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();
diff --git a/test/scripts/apidocs/__snapshots__/verify-jsdoc-tags.spec.ts.snap b/test/scripts/apidocs/__snapshots__/verify-jsdoc-tags.spec.ts.snap
index 94cdab92..083c128a 100644
--- a/test/scripts/apidocs/__snapshots__/verify-jsdoc-tags.spec.ts.snap
+++ b/test/scripts/apidocs/__snapshots__/verify-jsdoc-tags.spec.ts.snap
@@ -172,7 +172,6 @@ exports[`check docs completeness > all modules and methods are present 1`] = `
"ethereumAddress",
"iban",
"litecoinAddress",
- "maskedNumber",
"pin",
"routingNumber",
"transactionDescription",
@@ -242,19 +241,16 @@ exports[`check docs completeness > all modules and methods are present 1`] = `
[
"avatar",
"avatarGitHub",
- "avatarLegacy",
"dataUri",
"personPortrait",
"url",
"urlLoremFlickr",
"urlPicsumPhotos",
- "urlPlaceholder",
],
],
[
"internet",
[
- "color",
"displayName",
"domainName",
"domainSuffix",
@@ -276,7 +272,6 @@ exports[`check docs completeness > all modules and methods are present 1`] = `
"url",
"userAgent",
"username",
- "userName",
],
],
[
diff --git a/test/scripts/apidocs/verify-jsdoc-tags.spec.ts b/test/scripts/apidocs/verify-jsdoc-tags.spec.ts
index 0ffac8e0..b08840e0 100644
--- a/test/scripts/apidocs/verify-jsdoc-tags.spec.ts
+++ b/test/scripts/apidocs/verify-jsdoc-tags.spec.ts
@@ -35,11 +35,6 @@ function resolvePathToMethodFile(
signature: number
): string {
const dir = resolveDirToModule(moduleName);
- // TODO @ST-DDT 2024-09-23: Remove this in v10
- if (methodName === 'userName') {
- methodName = 'userNameDeprecated';
- }
-
return resolve(dir, `${methodName}_${signature}.ts`);
}