aboutsummaryrefslogtreecommitdiff
path: root/test/scripts
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2024-11-14 22:41:21 +0100
committerGitHub <[email protected]>2024-11-14 21:41:21 +0000
commitef24bff82cf5eac22e2d76bff9bcc0278a17a786 (patch)
treea9d4d76836be336d07bb53acd9c5ae308d02ac4f /test/scripts
parent467bd83dbd2f34dbd5080c45de18901823f83469 (diff)
downloadfaker-ef24bff82cf5eac22e2d76bff9bcc0278a17a786.tar.xz
faker-ef24bff82cf5eac22e2d76bff9bcc0278a17a786.zip
docs: expose documentation for all utilities (#3242)
Diffstat (limited to 'test/scripts')
-rw-r--r--test/scripts/apidocs/__snapshots__/verify-jsdoc-tags.spec.ts.snap435
-rw-r--r--test/scripts/apidocs/verify-jsdoc-tags.spec.ts12
2 files changed, 447 insertions, 0 deletions
diff --git a/test/scripts/apidocs/__snapshots__/verify-jsdoc-tags.spec.ts.snap b/test/scripts/apidocs/__snapshots__/verify-jsdoc-tags.spec.ts.snap
new file mode 100644
index 00000000..bc3ee0a0
--- /dev/null
+++ b/test/scripts/apidocs/__snapshots__/verify-jsdoc-tags.spec.ts.snap
@@ -0,0 +1,435 @@
+// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+
+exports[`check docs completeness > all modules and methods are present 1`] = `
+[
+ [
+ "faker",
+ [
+ "constructor",
+ "getMetadata",
+ "seed",
+ "setDefaultRefDate",
+ ],
+ ],
+ [
+ "simpleFaker",
+ [
+ "constructor",
+ "seed",
+ "setDefaultRefDate",
+ ],
+ ],
+ [
+ "randomizer",
+ [
+ "next",
+ "seed",
+ ],
+ ],
+ [
+ "utils",
+ [
+ "generateMersenne32Randomizer",
+ "generateMersenne53Randomizer",
+ "mergeLocales",
+ ],
+ ],
+ [
+ "airline",
+ [
+ "aircraftType",
+ "airline",
+ "airplane",
+ "airport",
+ "flightNumber",
+ "recordLocator",
+ "seat",
+ ],
+ ],
+ [
+ "animal",
+ [
+ "bear",
+ "bird",
+ "cat",
+ "cetacean",
+ "cow",
+ "crocodilia",
+ "dog",
+ "fish",
+ "horse",
+ "insect",
+ "lion",
+ "petName",
+ "rabbit",
+ "rodent",
+ "snake",
+ "type",
+ ],
+ ],
+ [
+ "book",
+ [
+ "author",
+ "format",
+ "genre",
+ "publisher",
+ "series",
+ "title",
+ ],
+ ],
+ [
+ "color",
+ [
+ "cmyk",
+ "colorByCSSColorSpace",
+ "cssSupportedFunction",
+ "cssSupportedSpace",
+ "hsl",
+ "human",
+ "hwb",
+ "lab",
+ "lch",
+ "rgb",
+ "space",
+ ],
+ ],
+ [
+ "commerce",
+ [
+ "department",
+ "isbn",
+ "price",
+ "product",
+ "productAdjective",
+ "productDescription",
+ "productMaterial",
+ "productName",
+ ],
+ ],
+ [
+ "company",
+ [
+ "buzzAdjective",
+ "buzzNoun",
+ "buzzPhrase",
+ "buzzVerb",
+ "catchPhrase",
+ "catchPhraseAdjective",
+ "catchPhraseDescriptor",
+ "catchPhraseNoun",
+ "name",
+ ],
+ ],
+ [
+ "database",
+ [
+ "collation",
+ "column",
+ "engine",
+ "mongodbObjectId",
+ "type",
+ ],
+ ],
+ [
+ "datatype",
+ [
+ "boolean",
+ ],
+ ],
+ [
+ "date",
+ [
+ "anytime",
+ "between",
+ "betweens",
+ "birthdate",
+ "future",
+ "month",
+ "past",
+ "recent",
+ "soon",
+ "timeZone",
+ "weekday",
+ ],
+ ],
+ [
+ "finance",
+ [
+ "accountName",
+ "accountNumber",
+ "amount",
+ "bic",
+ "bitcoinAddress",
+ "creditCardCVV",
+ "creditCardIssuer",
+ "creditCardNumber",
+ "currency",
+ "currencyCode",
+ "currencyName",
+ "currencySymbol",
+ "ethereumAddress",
+ "iban",
+ "litecoinAddress",
+ "maskedNumber",
+ "pin",
+ "routingNumber",
+ "transactionDescription",
+ "transactionType",
+ ],
+ ],
+ [
+ "food",
+ [
+ "adjective",
+ "description",
+ "dish",
+ "ethnicCategory",
+ "fruit",
+ "ingredient",
+ "meat",
+ "spice",
+ "vegetable",
+ ],
+ ],
+ [
+ "git",
+ [
+ "branch",
+ "commitDate",
+ "commitEntry",
+ "commitMessage",
+ "commitSha",
+ ],
+ ],
+ [
+ "hacker",
+ [
+ "abbreviation",
+ "adjective",
+ "ingverb",
+ "noun",
+ "phrase",
+ "verb",
+ ],
+ ],
+ [
+ "helpers",
+ [
+ "arrayElement",
+ "arrayElements",
+ "enumValue",
+ "fake",
+ "fromRegExp",
+ "maybe",
+ "multiple",
+ "mustache",
+ "objectEntry",
+ "objectKey",
+ "objectValue",
+ "rangeToNumber",
+ "replaceCreditCardSymbols",
+ "replaceSymbols",
+ "shuffle",
+ "slugify",
+ "uniqueArray",
+ "weightedArrayElement",
+ ],
+ ],
+ [
+ "image",
+ [
+ "avatar",
+ "avatarGitHub",
+ "avatarLegacy",
+ "dataUri",
+ "url",
+ "urlLoremFlickr",
+ "urlPicsumPhotos",
+ "urlPlaceholder",
+ ],
+ ],
+ [
+ "internet",
+ [
+ "color",
+ "displayName",
+ "domainName",
+ "domainSuffix",
+ "domainWord",
+ "email",
+ "emoji",
+ "exampleEmail",
+ "httpMethod",
+ "httpStatusCode",
+ "ip",
+ "ipv4",
+ "ipv6",
+ "jwt",
+ "jwtAlgorithm",
+ "mac",
+ "password",
+ "port",
+ "protocol",
+ "url",
+ "userAgent",
+ "username",
+ "userName",
+ ],
+ ],
+ [
+ "location",
+ [
+ "buildingNumber",
+ "cardinalDirection",
+ "city",
+ "continent",
+ "country",
+ "countryCode",
+ "county",
+ "direction",
+ "latitude",
+ "longitude",
+ "nearbyGPSCoordinate",
+ "ordinalDirection",
+ "secondaryAddress",
+ "state",
+ "street",
+ "streetAddress",
+ "timeZone",
+ "zipCode",
+ ],
+ ],
+ [
+ "lorem",
+ [
+ "lines",
+ "paragraph",
+ "paragraphs",
+ "sentence",
+ "sentences",
+ "slug",
+ "text",
+ "word",
+ "words",
+ ],
+ ],
+ [
+ "music",
+ [
+ "album",
+ "artist",
+ "genre",
+ "songName",
+ ],
+ ],
+ [
+ "number",
+ [
+ "bigInt",
+ "binary",
+ "float",
+ "hex",
+ "int",
+ "octal",
+ "romanNumeral",
+ ],
+ ],
+ [
+ "person",
+ [
+ "bio",
+ "firstName",
+ "fullName",
+ "gender",
+ "jobArea",
+ "jobDescriptor",
+ "jobTitle",
+ "jobType",
+ "lastName",
+ "middleName",
+ "prefix",
+ "sex",
+ "sexType",
+ "suffix",
+ "zodiacSign",
+ ],
+ ],
+ [
+ "phone",
+ [
+ "imei",
+ "number",
+ ],
+ ],
+ [
+ "science",
+ [
+ "chemicalElement",
+ "unit",
+ ],
+ ],
+ [
+ "string",
+ [
+ "alpha",
+ "alphanumeric",
+ "binary",
+ "fromCharacters",
+ "hexadecimal",
+ "nanoid",
+ "numeric",
+ "octal",
+ "sample",
+ "symbol",
+ "ulid",
+ "uuid",
+ ],
+ ],
+ [
+ "system",
+ [
+ "commonFileExt",
+ "commonFileName",
+ "commonFileType",
+ "cron",
+ "directoryPath",
+ "fileExt",
+ "fileName",
+ "filePath",
+ "fileType",
+ "mimeType",
+ "networkInterface",
+ "semver",
+ ],
+ ],
+ [
+ "vehicle",
+ [
+ "bicycle",
+ "color",
+ "fuel",
+ "manufacturer",
+ "model",
+ "type",
+ "vehicle",
+ "vin",
+ "vrm",
+ ],
+ ],
+ [
+ "word",
+ [
+ "adjective",
+ "adverb",
+ "conjunction",
+ "interjection",
+ "noun",
+ "preposition",
+ "sample",
+ "verb",
+ "words",
+ ],
+ ],
+]
+`;
diff --git a/test/scripts/apidocs/verify-jsdoc-tags.spec.ts b/test/scripts/apidocs/verify-jsdoc-tags.spec.ts
index 0456d8ee..e476c60b 100644
--- a/test/scripts/apidocs/verify-jsdoc-tags.spec.ts
+++ b/test/scripts/apidocs/verify-jsdoc-tags.spec.ts
@@ -78,6 +78,18 @@ function assertDescription(description: string): void {
}
}
+describe('check docs completeness', () => {
+ it('all modules and methods are present', () => {
+ // This could be converted to an Object, but that would erase the order of the pages
+ const pageContents = modules.map((m) => [
+ m.camelTitle,
+ m.methods.map((m) => m.name),
+ ]);
+
+ expect(pageContents).toMatchSnapshot();
+ });
+});
+
describe('verify JSDoc tags', () => {
describe.each(modules.map((m) => [m.camelTitle, m]))(
'%s',