diff --git a/test/__snapshots__/address.spec.ts.snap b/test/__snapshots__/address.spec.ts.snap new file mode 100644 index 00000000000..04956b4e2d9 --- /dev/null +++ b/test/__snapshots__/address.spec.ts.snap @@ -0,0 +1,166 @@ +// Vitest Snapshot v1 + +exports[`address > seed: 42 > cardinalDirection() > returns abbreviation when useAbbr is true 1`] = `"E"`; + +exports[`address > seed: 42 > cardinalDirection() > returns random cardinal direction 1`] = `"East"`; + +exports[`address > seed: 42 > city() 1`] = `"Port Valentine"`; + +exports[`address > seed: 42 > cityName() 1`] = `"Gulfport"`; + +exports[`address > seed: 42 > cityPrefix() 1`] = `"West"`; + +exports[`address > seed: 42 > citySuffix() 1`] = `"bury"`; + +exports[`address > seed: 42 > country() 1`] = `"Haiti"`; + +exports[`address > seed: 42 > countryCode() 1`] = `"GY"`; + +exports[`address > seed: 42 > county() 1`] = `"Berkshire"`; + +exports[`address > seed: 42 > direction() > returns abbreviation when useAbbr is true 1`] = `"S"`; + +exports[`address > seed: 42 > direction() > returns random direction 1`] = `"South"`; + +exports[`address > seed: 42 > direction() > should not return abbreviation when useAbbr is false 1`] = `"South"`; + +exports[`address > seed: 42 > nearbyGPSCoordinate() > returns expected coordinates 1`] = ` +[ + "0.0814", + "-0.0809", +] +`; + +exports[`address > seed: 42 > ordinalDirection() > returns abbreviation when useAbbr is true 1`] = `"NW"`; + +exports[`address > seed: 42 > ordinalDirection() > returns random ordinal direction 1`] = `"Northwest"`; + +exports[`address > seed: 42 > secondaryAddress() 1`] = `"Apt. 791"`; + +exports[`address > seed: 42 > state() 1`] = `"Maine"`; + +exports[`address > seed: 42 > stateAbbr() 1`] = `"ME"`; + +exports[`address > seed: 42 > streetAddress() > should return street name with a building number 1`] = `"7917 Metz Pine"`; + +exports[`address > seed: 42 > streetAddress() > should return street name with a building number and a secondary address 1`] = `"7917 Metz Pine Apt. 410"`; + +exports[`address > seed: 42 > streetName() 1`] = `"Peyton Village"`; + +exports[`address > seed: 42 > streetPrefix() 1`] = `"b"`; + +exports[`address > seed: 42 > streetSuffix() 1`] = `"Isle"`; + +exports[`address > seed: 42 > timeZone() 1`] = `"Europe/Amsterdam"`; + +exports[`address > seed: 42 > zipCode() 1`] = `"79177"`; + +exports[`address > seed: 1211 > cardinalDirection() > returns abbreviation when useAbbr is true 1`] = `"W"`; + +exports[`address > seed: 1211 > cardinalDirection() > returns random cardinal direction 1`] = `"West"`; + +exports[`address > seed: 1211 > city() 1`] = `"La Crosse"`; + +exports[`address > seed: 1211 > cityName() 1`] = `"Urbana"`; + +exports[`address > seed: 1211 > cityPrefix() 1`] = `"Fort"`; + +exports[`address > seed: 1211 > citySuffix() 1`] = `"shire"`; + +exports[`address > seed: 1211 > country() 1`] = `"Uganda"`; + +exports[`address > seed: 1211 > countryCode() 1`] = `"UM"`; + +exports[`address > seed: 1211 > county() 1`] = `"Cambridgeshire"`; + +exports[`address > seed: 1211 > direction() > returns abbreviation when useAbbr is true 1`] = `"SW"`; + +exports[`address > seed: 1211 > direction() > returns random direction 1`] = `"Southwest"`; + +exports[`address > seed: 1211 > direction() > should not return abbreviation when useAbbr is false 1`] = `"Southwest"`; + +exports[`address > seed: 1211 > nearbyGPSCoordinate() > returns expected coordinates 1`] = ` +[ + "-0.0287", + "0.0596", +] +`; + +exports[`address > seed: 1211 > ordinalDirection() > returns abbreviation when useAbbr is true 1`] = `"SW"`; + +exports[`address > seed: 1211 > ordinalDirection() > returns random ordinal direction 1`] = `"Southwest"`; + +exports[`address > seed: 1211 > secondaryAddress() 1`] = `"Suite 487"`; + +exports[`address > seed: 1211 > state() 1`] = `"Washington"`; + +exports[`address > seed: 1211 > stateAbbr() 1`] = `"WA"`; + +exports[`address > seed: 1211 > streetAddress() > should return street name with a building number 1`] = `"487 Breana Wells"`; + +exports[`address > seed: 1211 > streetAddress() > should return street name with a building number and a secondary address 1`] = `"487 Breana Wells Apt. 616"`; + +exports[`address > seed: 1211 > streetName() 1`] = `"Koch Turnpike"`; + +exports[`address > seed: 1211 > streetPrefix() 1`] = `"c"`; + +exports[`address > seed: 1211 > streetSuffix() 1`] = `"Via"`; + +exports[`address > seed: 1211 > timeZone() 1`] = `"Asia/Magadan"`; + +exports[`address > seed: 1211 > zipCode() 1`] = `"48721-9061"`; + +exports[`address > seed: 1337 > cardinalDirection() > returns abbreviation when useAbbr is true 1`] = `"E"`; + +exports[`address > seed: 1337 > cardinalDirection() > returns random cardinal direction 1`] = `"East"`; + +exports[`address > seed: 1337 > city() 1`] = `"New Carmelo"`; + +exports[`address > seed: 1337 > cityName() 1`] = `"Dubuque"`; + +exports[`address > seed: 1337 > cityPrefix() 1`] = `"West"`; + +exports[`address > seed: 1337 > citySuffix() 1`] = `"boro"`; + +exports[`address > seed: 1337 > country() 1`] = `"Equatorial Guinea"`; + +exports[`address > seed: 1337 > countryCode() 1`] = `"EH"`; + +exports[`address > seed: 1337 > county() 1`] = `"Bedfordshire"`; + +exports[`address > seed: 1337 > direction() > returns abbreviation when useAbbr is true 1`] = `"S"`; + +exports[`address > seed: 1337 > direction() > returns random direction 1`] = `"South"`; + +exports[`address > seed: 1337 > direction() > should not return abbreviation when useAbbr is false 1`] = `"South"`; + +exports[`address > seed: 1337 > nearbyGPSCoordinate() > returns expected coordinates 1`] = ` +[ + "0.0806", + "-0.0061", +] +`; + +exports[`address > seed: 1337 > ordinalDirection() > returns abbreviation when useAbbr is true 1`] = `"NW"`; + +exports[`address > seed: 1337 > ordinalDirection() > returns random ordinal direction 1`] = `"Northwest"`; + +exports[`address > seed: 1337 > secondaryAddress() 1`] = `"Apt. 512"`; + +exports[`address > seed: 1337 > state() 1`] = `"Indiana"`; + +exports[`address > seed: 1337 > stateAbbr() 1`] = `"IN"`; + +exports[`address > seed: 1337 > streetAddress() > should return street name with a building number 1`] = `"51225 Alexys Haven"`; + +exports[`address > seed: 1337 > streetAddress() > should return street name with a building number and a secondary address 1`] = `"51225 Alexys Haven Apt. 552"`; + +exports[`address > seed: 1337 > streetName() 1`] = `"Keith Dam"`; + +exports[`address > seed: 1337 > streetPrefix() 1`] = `"a"`; + +exports[`address > seed: 1337 > streetSuffix() 1`] = `"Forks"`; + +exports[`address > seed: 1337 > timeZone() 1`] = `"Africa/Casablanca"`; + +exports[`address > seed: 1337 > zipCode() 1`] = `"51225"`; diff --git a/test/__snapshots__/animal.spec.ts.snap b/test/__snapshots__/animal.spec.ts.snap new file mode 100644 index 00000000000..8d4b4f4dcc9 --- /dev/null +++ b/test/__snapshots__/animal.spec.ts.snap @@ -0,0 +1,85 @@ +// Vitest Snapshot v1 + +exports[`animal > seed: 42 > bear() 1`] = `"Sun bear"`; + +exports[`animal > seed: 42 > bird() 1`] = `"Iceland Gull"`; + +exports[`animal > seed: 42 > cat() 1`] = `"Himalayan"`; + +exports[`animal > seed: 42 > cetacean() 1`] = `"Pantropical Spotted Dolphin"`; + +exports[`animal > seed: 42 > cow() 1`] = `"Fleckvieh"`; + +exports[`animal > seed: 42 > crocodilia() 1`] = `"African Slender-snouted Crocodile"`; + +exports[`animal > seed: 42 > dog() 1`] = `"Garafian Shepherd"`; + +exports[`animal > seed: 42 > fish() 1`] = `"Northern snakehead"`; + +exports[`animal > seed: 42 > horse() 1`] = `"Furioso-North Star"`; + +exports[`animal > seed: 42 > insect() 1`] = `"Gouty oak gall"`; + +exports[`animal > seed: 42 > lion() 1`] = `"West African Lion"`; + +exports[`animal > seed: 42 > rabbit() 1`] = `"English Spot"`; + +exports[`animal > seed: 42 > snake() 1`] = `"Grey-banded kingsnake"`; + +exports[`animal > seed: 42 > type() 1`] = `"lion"`; + +exports[`animal > seed: 1211 > bear() 1`] = `"Polar bear"`; + +exports[`animal > seed: 1211 > bird() 1`] = `"Reed Bunting"`; + +exports[`animal > seed: 1211 > cat() 1`] = `"Tonkinese"`; + +exports[`animal > seed: 1211 > cetacean() 1`] = `"La Plata Dolphin"`; + +exports[`animal > seed: 1211 > cow() 1`] = `"Breed"`; + +exports[`animal > seed: 1211 > crocodilia() 1`] = `"Gharial"`; + +exports[`animal > seed: 1211 > dog() 1`] = `"Tibetan Spaniel"`; + +exports[`animal > seed: 1211 > fish() 1`] = `"Bigeye scad"`; + +exports[`animal > seed: 1211 > horse() 1`] = `"Ukrainian Riding Horse"`; + +exports[`animal > seed: 1211 > insect() 1`] = `"Western paper wasp"`; + +exports[`animal > seed: 1211 > lion() 1`] = `"Cape lion"`; + +exports[`animal > seed: 1211 > rabbit() 1`] = `"Silver Marten"`; + +exports[`animal > seed: 1211 > snake() 1`] = `"Tiger pit viper"`; + +exports[`animal > seed: 1211 > type() 1`] = `"horse"`; + +exports[`animal > seed: 1337 > bear() 1`] = `"Sun bear"`; + +exports[`animal > seed: 1337 > bird() 1`] = `"American Golden-Plover"`; + +exports[`animal > seed: 1337 > cat() 1`] = `"Devon Rex"`; + +exports[`animal > seed: 1337 > cetacean() 1`] = `"Costero"`; + +exports[`animal > seed: 1337 > cow() 1`] = `"Canchim"`; + +exports[`animal > seed: 1337 > crocodilia() 1`] = `"Cuvierโ€™s Dwarf Caiman"`; + +exports[`animal > seed: 1337 > dog() 1`] = `"Chinese Crested Dog"`; + +exports[`animal > seed: 1337 > fish() 1`] = `"Jumbo flying squid"`; + +exports[`animal > seed: 1337 > horse() 1`] = `"Colorado Ranger"`; + +exports[`animal > seed: 1337 > insect() 1`] = `"Eulophid wasp"`; + +exports[`animal > seed: 1337 > lion() 1`] = `"Barbary Lion"`; + +exports[`animal > seed: 1337 > rabbit() 1`] = `"Cinnamon"`; + +exports[`animal > seed: 1337 > snake() 1`] = `"Fierce snake"`; + +exports[`animal > seed: 1337 > type() 1`] = `"bear"`; diff --git a/test/__snapshots__/color.spec.ts.snap b/test/__snapshots__/color.spec.ts.snap new file mode 100644 index 00000000000..5d74dd479c2 --- /dev/null +++ b/test/__snapshots__/color.spec.ts.snap @@ -0,0 +1,178 @@ +// Vitest Snapshot v1 + +exports[`color > seed: 42 > cmyk() 1`] = ` +[ + 0.37, + 0.8, + 0.96, + 0.18, +] +`; + +exports[`color > seed: 42 > colorByCSSColorSpace() 1`] = ` +[ + 0.3745, + 0.7966, + 0.9508, +] +`; + +exports[`color > seed: 42 > cssSupportedFunction() 1`] = `"hsla"`; + +exports[`color > seed: 42 > cssSupportedSpace() 1`] = `"rec2020"`; + +exports[`color > seed: 42 > hsl() 1`] = ` +[ + 135, + 0.8, + 0.96, +] +`; + +exports[`color > seed: 42 > human() 1`] = `"grey"`; + +exports[`color > seed: 42 > hwb() 1`] = ` +[ + 135, + 0.8, + 0.96, +] +`; + +exports[`color > seed: 42 > lab() 1`] = ` +[ + 0.37454, + 59.3086, + 90.1429, +] +`; + +exports[`color > seed: 42 > lch() 1`] = ` +[ + 0.37454, + 183.2, + 218.7, +] +`; + +exports[`color > seed: 42 > rgb() 1`] = `"#8be4ab"`; + +exports[`color > seed: 42 > space() 1`] = `"Rec. 709"`; + +exports[`color > seed: 1211 > cmyk() 1`] = ` +[ + 0.93, + 0.46, + 0.9, + 0.78, +] +`; + +exports[`color > seed: 1211 > colorByCSSColorSpace() 1`] = ` +[ + 0.9286, + 0.459, + 0.8935, +] +`; + +exports[`color > seed: 1211 > cssSupportedFunction() 1`] = `"color"`; + +exports[`color > seed: 1211 > cssSupportedSpace() 1`] = `"rec2020"`; + +exports[`color > seed: 1211 > hsl() 1`] = ` +[ + 335, + 0.46, + 0.9, +] +`; + +exports[`color > seed: 1211 > human() 1`] = `"azure"`; + +exports[`color > seed: 1211 > hwb() 1`] = ` +[ + 335, + 0.46, + 0.9, +] +`; + +exports[`color > seed: 1211 > lab() 1`] = ` +[ + 0.928521, + -8.197, + 78.6944, +] +`; + +exports[`color > seed: 1211 > lch() 1`] = ` +[ + 0.928521, + 105.6, + 205.5, +] +`; + +exports[`color > seed: 1211 > rgb() 1`] = `"#eadb42"`; + +exports[`color > seed: 1211 > space() 1`] = `"LMS"`; + +exports[`color > seed: 1337 > cmyk() 1`] = ` +[ + 0.26, + 0.56, + 0.16, + 0.21, +] +`; + +exports[`color > seed: 1337 > colorByCSSColorSpace() 1`] = ` +[ + 0.262, + 0.5605, + 0.1586, +] +`; + +exports[`color > seed: 1337 > cssSupportedFunction() 1`] = `"hsl"`; + +exports[`color > seed: 1337 > cssSupportedSpace() 1`] = `"display-p3"`; + +exports[`color > seed: 1337 > hsl() 1`] = ` +[ + 94, + 0.56, + 0.16, +] +`; + +exports[`color > seed: 1337 > human() 1`] = `"black"`; + +exports[`color > seed: 1337 > hwb() 1`] = ` +[ + 94, + 0.56, + 0.16, +] +`; + +exports[`color > seed: 1337 > lab() 1`] = ` +[ + 0.262024, + 12.106, + -68.2632, +] +`; + +exports[`color > seed: 1337 > lch() 1`] = ` +[ + 0.262024, + 128.9, + 36.5, +] +`; + +exports[`color > seed: 1337 > rgb() 1`] = `"#5c346b"`; + +exports[`color > seed: 1337 > space() 1`] = `"ProPhoto RGB Color Space"`; diff --git a/test/__snapshots__/commerce.spec.ts.snap b/test/__snapshots__/commerce.spec.ts.snap new file mode 100644 index 00000000000..eeb210fba7f --- /dev/null +++ b/test/__snapshots__/commerce.spec.ts.snap @@ -0,0 +1,49 @@ +// Vitest Snapshot v1 + +exports[`commerce > seed: 42 > color() 1`] = `"grey"`; + +exports[`commerce > seed: 42 > department() 1`] = `"Tools"`; + +exports[`commerce > seed: 42 > price() 1`] = `"375.00"`; + +exports[`commerce > seed: 42 > product() 1`] = `"Pants"`; + +exports[`commerce > seed: 42 > productAdjective() 1`] = `"Fantastic"`; + +exports[`commerce > seed: 42 > productDescription() 1`] = `"The Apollotech B340 is an affordable wireless mouse with reliable connectivity, 12 months battery life and modern design"`; + +exports[`commerce > seed: 42 > productMaterial() 1`] = `"Plastic"`; + +exports[`commerce > seed: 42 > productName() 1`] = `"Fantastic Soft Sausages"`; + +exports[`commerce > seed: 1211 > color() 1`] = `"azure"`; + +exports[`commerce > seed: 1211 > department() 1`] = `"Automotive"`; + +exports[`commerce > seed: 1211 > price() 1`] = `"929.00"`; + +exports[`commerce > seed: 1211 > product() 1`] = `"Sausages"`; + +exports[`commerce > seed: 1211 > productAdjective() 1`] = `"Unbranded"`; + +exports[`commerce > seed: 1211 > productDescription() 1`] = `"Andy shoes are designed to keeping in mind durability as well as trends, the most stylish range of shoes & sandals"`; + +exports[`commerce > seed: 1211 > productMaterial() 1`] = `"Frozen"`; + +exports[`commerce > seed: 1211 > productName() 1`] = `"Unbranded Cotton Salad"`; + +exports[`commerce > seed: 1337 > color() 1`] = `"black"`; + +exports[`commerce > seed: 1337 > department() 1`] = `"Computers"`; + +exports[`commerce > seed: 1337 > price() 1`] = `"263.00"`; + +exports[`commerce > seed: 1337 > product() 1`] = `"Ball"`; + +exports[`commerce > seed: 1337 > productAdjective() 1`] = `"Incredible"`; + +exports[`commerce > seed: 1337 > productDescription() 1`] = `"The slim & simple Maple Gaming Keyboard from Dev Byte comes with a sleek body and 7- Color RGB LED Back-lighting for smart functionality"`; + +exports[`commerce > seed: 1337 > productMaterial() 1`] = `"Concrete"`; + +exports[`commerce > seed: 1337 > productName() 1`] = `"Incredible Granite Keyboard"`; diff --git a/test/__snapshots__/company.spec.ts.snap b/test/__snapshots__/company.spec.ts.snap new file mode 100644 index 00000000000..f4dfd000e64 --- /dev/null +++ b/test/__snapshots__/company.spec.ts.snap @@ -0,0 +1,88 @@ +// Vitest Snapshot v1 + +exports[`company > seed: 42 > bs() 1`] = `"seize impactful web services"`; + +exports[`company > seed: 42 > bsAdjective() 1`] = `"dynamic"`; + +exports[`company > seed: 42 > bsBuzz() 1`] = `"seize"`; + +exports[`company > seed: 42 > bsNoun() 1`] = `"portals"`; + +exports[`company > seed: 42 > catchPhrase() 1`] = `"Implemented responsive throughput"`; + +exports[`company > seed: 42 > catchPhraseAdjective() 1`] = `"Implemented"`; + +exports[`company > seed: 42 > catchPhraseDescriptor() 1`] = `"explicit"`; + +exports[`company > seed: 42 > catchPhraseNoun() 1`] = `"framework"`; + +exports[`company > seed: 42 > companyName() 1`] = `"Schinner - Wiegand"`; + +exports[`company > seed: 42 > companySuffix() 1`] = `"and Sons"`; + +exports[`company > seed: 42 > suffixes() 1`] = ` +[ + "Inc", + "and Sons", + "LLC", + "Group", +] +`; + +exports[`company > seed: 1211 > bs() 1`] = `"cultivate bleeding-edge functionalities"`; + +exports[`company > seed: 1211 > bsAdjective() 1`] = `"plug-and-play"`; + +exports[`company > seed: 1211 > bsBuzz() 1`] = `"cultivate"`; + +exports[`company > seed: 1211 > bsNoun() 1`] = `"experiences"`; + +exports[`company > seed: 1211 > catchPhrase() 1`] = `"Up-sized high-level success"`; + +exports[`company > seed: 1211 > catchPhraseAdjective() 1`] = `"Up-sized"`; + +exports[`company > seed: 1211 > catchPhraseDescriptor() 1`] = `"upward-trending"`; + +exports[`company > seed: 1211 > catchPhraseNoun() 1`] = `"system engine"`; + +exports[`company > seed: 1211 > companyName() 1`] = `"Koch, Trantow and Sanford"`; + +exports[`company > seed: 1211 > companySuffix() 1`] = `"Group"`; + +exports[`company > seed: 1211 > suffixes() 1`] = ` +[ + "Inc", + "and Sons", + "LLC", + "Group", +] +`; + +exports[`company > seed: 1337 > bs() 1`] = `"incentivize efficient initiatives"`; + +exports[`company > seed: 1337 > bsAdjective() 1`] = `"global"`; + +exports[`company > seed: 1337 > bsBuzz() 1`] = `"incentivize"`; + +exports[`company > seed: 1337 > bsNoun() 1`] = `"ROI"`; + +exports[`company > seed: 1337 > catchPhrase() 1`] = `"Expanded leading edge capacity"`; + +exports[`company > seed: 1337 > catchPhraseAdjective() 1`] = `"Expanded"`; + +exports[`company > seed: 1337 > catchPhraseDescriptor() 1`] = `"demand-driven"`; + +exports[`company > seed: 1337 > catchPhraseNoun() 1`] = `"data-warehouse"`; + +exports[`company > seed: 1337 > companyName() 1`] = `"Macejkovic Inc"`; + +exports[`company > seed: 1337 > companySuffix() 1`] = `"and Sons"`; + +exports[`company > seed: 1337 > suffixes() 1`] = ` +[ + "Inc", + "and Sons", + "LLC", + "Group", +] +`; diff --git a/test/__snapshots__/database.spec.ts.snap b/test/__snapshots__/database.spec.ts.snap new file mode 100644 index 00000000000..7542fca1bf7 --- /dev/null +++ b/test/__snapshots__/database.spec.ts.snap @@ -0,0 +1,31 @@ +// Vitest Snapshot v1 + +exports[`database > seed: 42 > collation() 1`] = `"utf8_bin"`; + +exports[`database > seed: 42 > column() 1`] = `"token"`; + +exports[`database > seed: 42 > engine() 1`] = `"MEMORY"`; + +exports[`database > seed: 42 > mongodbObjectId() 1`] = `"8be4abdd39321ad7d3fe01ff"`; + +exports[`database > seed: 42 > type() 1`] = `"smallint"`; + +exports[`database > seed: 1211 > collation() 1`] = `"cp1250_general_ci"`; + +exports[`database > seed: 1211 > column() 1`] = `"createdAt"`; + +exports[`database > seed: 1211 > engine() 1`] = `"ARCHIVE"`; + +exports[`database > seed: 1211 > mongodbObjectId() 1`] = `"eadb42f0e3f4a973fab0aeef"`; + +exports[`database > seed: 1211 > type() 1`] = `"geometry"`; + +exports[`database > seed: 1337 > collation() 1`] = `"utf8_general_ci"`; + +exports[`database > seed: 1337 > column() 1`] = `"email"`; + +exports[`database > seed: 1337 > engine() 1`] = `"MyISAM"`; + +exports[`database > seed: 1337 > mongodbObjectId() 1`] = `"5c346ba075bd57f5a62b82d7"`; + +exports[`database > seed: 1337 > type() 1`] = `"time"`; diff --git a/test/__snapshots__/datatype.spec.ts.snap b/test/__snapshots__/datatype.spec.ts.snap new file mode 100644 index 00000000000..c04dcf950c6 --- /dev/null +++ b/test/__snapshots__/datatype.spec.ts.snap @@ -0,0 +1,277 @@ +// Vitest Snapshot v1 + +exports[`datatype > seed: 42 > array > should return a deterministic array of given length 1`] = ` +[ + 79654, + "2eiXX/J/*&", + 86617, + 60111, +] +`; + +exports[`datatype > seed: 42 > array() 1`] = ` +[ + 79654, + "2eiXX/J/*&", + 86617, + 60111, + 70807, + "\\"&{dnx4!1}", + 61748, + 61165, + "!I# seed: 42 > bigInt > should return a deterministic bigInt of given value 1`] = `37n`; + +exports[`datatype > seed: 42 > bigInt() 1`] = `379177551410048n`; + +exports[`datatype > seed: 42 > boolean() 1`] = `false`; + +exports[`datatype > seed: 42 > datetime > should return a deterministic date when given a max date 1`] = `1994-07-11T09:43:47.230Z`; + +exports[`datatype > seed: 42 > datetime > should return a deterministic date when given a min and max date 1`] = `1689-09-09T08:39:09.444Z`; + +exports[`datatype > seed: 42 > datetime > should return a deterministic date when given a min date 1`] = `1801-04-11T15:13:06.330Z`; + +exports[`datatype > seed: 42 > datetime > should return a deterministic date when given a number 1`] = `1994-03-20T17:23:00.629Z`; + +exports[`datatype > seed: 42 > datetime() 1`] = `2031-03-14T21:33:22.114Z`; + +exports[`datatype > seed: 42 > float > should return a deterministic value for given max 1`] = `25.84`; + +exports[`datatype > seed: 42 > float > should return a deterministic value for given min 1`] = `37411.64`; + +exports[`datatype > seed: 42 > float > should return a deterministic value for given min and max 1`] = `-0.43`; + +exports[`datatype > seed: 42 > float > should return a deterministic value for given min, max and precision 1`] = `-0.4261`; + +exports[`datatype > seed: 42 > float > should return a deterministic value for given number 1`] = `37452`; + +exports[`datatype > seed: 42 > float > should return a deterministic value for given number 2`] = `79656`; + +exports[`datatype > seed: 42 > float > should return a deterministic value for given number 3`] = `95076`; + +exports[`datatype > seed: 42 > float > should return a deterministic value for given number 4`] = `18342`; + +exports[`datatype > seed: 42 > float > should return a deterministic value for given number 5`] = `73200`; + +exports[`datatype > seed: 42 > float() 1`] = `37453.64`; + +exports[`datatype > seed: 42 > hexadecimal > should return a deterministic hex of given length 1`] = `"0x8BE4ABdd39321aD7d3fe01FfCE404F4d6db0906bd8"`; + +exports[`datatype > seed: 42 > hexadecimal() 1`] = `"0x8"`; + +exports[`datatype > seed: 42 > json() 1`] = `"{\\"foo\\":79654,\\"bar\\":\\"2eiXX/J/*&\\",\\"bike\\":86617,\\"a\\":60111,\\"b\\":70807,\\"name\\":\\"\\\\\\"&{dnx4!1}\\",\\"prop\\":61748}"`; + +exports[`datatype > seed: 42 > number > should return a deterministic value for given max 1`] = `26`; + +exports[`datatype > seed: 42 > number > should return a deterministic value for given min 1`] = `37412`; + +exports[`datatype > seed: 42 > number > should return a deterministic value for given min and max 1`] = `-1`; + +exports[`datatype > seed: 42 > number > should return a deterministic value for given min, max and precision 1`] = `-0.43`; + +exports[`datatype > seed: 42 > number > should return a deterministic value for given number 1`] = `2`; + +exports[`datatype > seed: 42 > number > should return a deterministic value for given number 2`] = `5`; + +exports[`datatype > seed: 42 > number > should return a deterministic value for given number 3`] = `6`; + +exports[`datatype > seed: 42 > number > should return a deterministic value for given number 4`] = `1`; + +exports[`datatype > seed: 42 > number > should return a deterministic value for given number 5`] = `5`; + +exports[`datatype > seed: 42 > number() 1`] = `37454`; + +exports[`datatype > seed: 42 > string > should return a deterministic string of given length 1`] = `"Cky2eiXX/J/*&Kq@X.b]\\"&{dnx4!1}2Z=YQ!I# seed: 42 > string() 1`] = `"Cky2eiXX/J"`; + +exports[`datatype > seed: 42 > uuid() 1`] = `"5cf2bc99-2721-407d-992b-a00fbdf302f2"`; + +exports[`datatype > seed: 1211 > array > should return a deterministic array of given length 1`] = ` +[ + "Kti5-}$_/\`", + 76408, + 35403, + 69406, +] +`; + +exports[`datatype > seed: 1211 > array() 1`] = ` +[ + "Kti5-}$_/\`", + 76408, + 35403, + 69406, + "l\\"h^]dnwI<", + "|p|5KWu3/C", + "|Jh!E=x\\"RH", + "/5V<1bEQuA", + "p=DW9F=V1(", + "7a6.$boN\\\\7", +] +`; + +exports[`datatype > seed: 1211 > bigInt > should return a deterministic bigInt of given value 1`] = `8n`; + +exports[`datatype > seed: 1211 > bigInt() 1`] = `948721906162743n`; + +exports[`datatype > seed: 1211 > boolean() 1`] = `true`; + +exports[`datatype > seed: 1211 > datetime > should return a deterministic date when given a max date 1`] = `2001-03-20T11:14:25.251Z`; + +exports[`datatype > seed: 1211 > datetime > should return a deterministic date when given a min and max date 1`] = `1789-03-26T15:44:45.219Z`; + +exports[`datatype > seed: 1211 > datetime > should return a deterministic date when given a min date 1`] = `2065-11-10T19:27:20.915Z`; + +exports[`datatype > seed: 1211 > datetime > should return a deterministic date when given a number 1`] = `2000-06-14T02:54:42.082Z`; + +exports[`datatype > seed: 1211 > datetime() 1`] = `2092-02-20T03:42:04.341Z`; + +exports[`datatype > seed: 1211 > float > should return a deterministic value for given max 1`] = `64.07`; + +exports[`datatype > seed: 1211 > float > should return a deterministic value for given min 1`] = `92809.09`; + +exports[`datatype > seed: 1211 > float > should return a deterministic value for given min and max 1`] = `61.07`; + +exports[`datatype > seed: 1211 > float > should return a deterministic value for given min, max and precision 1`] = `61.0658`; + +exports[`datatype > seed: 1211 > float > should return a deterministic value for given number 1`] = `92856`; + +exports[`datatype > seed: 1211 > float > should return a deterministic value for given number 2`] = `45900`; + +exports[`datatype > seed: 1211 > float > should return a deterministic value for given number 3`] = `89346`; + +exports[`datatype > seed: 1211 > float > should return a deterministic value for given number 4`] = `77826`; + +exports[`datatype > seed: 1211 > float > should return a deterministic value for given number 5`] = `22554`; + +exports[`datatype > seed: 1211 > float() 1`] = `92851.09`; + +exports[`datatype > seed: 1211 > hexadecimal > should return a deterministic hex of given length 1`] = `"0xEaDB42F0e3f4A973fAB0AeefCE96DFCF49cD438dF9"`; + +exports[`datatype > seed: 1211 > hexadecimal() 1`] = `"0xE"`; + +exports[`datatype > seed: 1211 > json() 1`] = `"{\\"foo\\":\\"Kti5-}$_/\`\\",\\"bar\\":76408,\\"bike\\":35403,\\"a\\":69406,\\"b\\":\\"l\\\\\\"h^]dnwI<\\",\\"name\\":\\"|p|5KWu3/C\\",\\"prop\\":\\"|Jh!E=x\\\\\\"RH\\"}"`; + +exports[`datatype > seed: 1211 > number > should return a deterministic value for given max 1`] = `64`; + +exports[`datatype > seed: 1211 > number > should return a deterministic value for given min 1`] = `92810`; + +exports[`datatype > seed: 1211 > number > should return a deterministic value for given min and max 1`] = `61`; + +exports[`datatype > seed: 1211 > number > should return a deterministic value for given min, max and precision 1`] = `61.07`; + +exports[`datatype > seed: 1211 > number > should return a deterministic value for given number 1`] = `6`; + +exports[`datatype > seed: 1211 > number > should return a deterministic value for given number 2`] = `3`; + +exports[`datatype > seed: 1211 > number > should return a deterministic value for given number 3`] = `6`; + +exports[`datatype > seed: 1211 > number > should return a deterministic value for given number 4`] = `5`; + +exports[`datatype > seed: 1211 > number > should return a deterministic value for given number 5`] = `1`; + +exports[`datatype > seed: 1211 > number() 1`] = `92852`; + +exports[`datatype > seed: 1211 > string > should return a deterministic string of given length 1`] = `"wKti5-}$_/\`4hHA0afl\\"h^]dnwI seed: 1211 > string() 1`] = `"wKti5-}$_/"`; + +exports[`datatype > seed: 1211 > uuid() 1`] = `"e7ec32f0-a2a3-4c65-abbd-0caabde64dfd"`; + +exports[`datatype > seed: 1337 > array > should return a deterministic array of given length 1`] = ` +[ + 56052, + 21258, + 54308, + 3397, +] +`; + +exports[`datatype > seed: 1337 > array() 1`] = ` +[ + 56052, + 21258, + 54308, + 3397, + 23538, + "X9@{:e=+kD", + 62850, + 12505, + "|/Jqjjj!BL", + 38106, +] +`; + +exports[`datatype > seed: 1337 > bigInt > should return a deterministic bigInt of given value 1`] = `25n`; + +exports[`datatype > seed: 1337 > bigInt() 1`] = `251225403255239n`; + +exports[`datatype > seed: 1337 > boolean() 1`] = `false`; + +exports[`datatype > seed: 1337 > datetime > should return a deterministic date when given a max date 1`] = `1993-03-02T00:10:04.335Z`; + +exports[`datatype > seed: 1337 > datetime > should return a deterministic date when given a min and max date 1`] = `1669-06-22T01:21:21.236Z`; + +exports[`datatype > seed: 1337 > datetime > should return a deterministic date when given a min date 1`] = `1747-07-16T01:19:54.159Z`; + +exports[`datatype > seed: 1337 > datetime > should return a deterministic date when given a number 1`] = `1992-12-13T04:13:59.232Z`; + +exports[`datatype > seed: 1337 > datetime() 1`] = `2018-10-28T08:46:11.896Z`; + +exports[`datatype > seed: 1337 > float > should return a deterministic value for given max 1`] = `18.08`; + +exports[`datatype > seed: 1337 > float > should return a deterministic value for given min 1`] = `26160.2`; + +exports[`datatype > seed: 1337 > float > should return a deterministic value for given min and max 1`] = `-12.92`; + +exports[`datatype > seed: 1337 > float > should return a deterministic value for given min, max and precision 1`] = `-12.9153`; + +exports[`datatype > seed: 1337 > float > should return a deterministic value for given number 1`] = `26202`; + +exports[`datatype > seed: 1337 > float > should return a deterministic value for given number 2`] = `56052`; + +exports[`datatype > seed: 1337 > float > should return a deterministic value for given number 3`] = `15864`; + +exports[`datatype > seed: 1337 > float > should return a deterministic value for given number 4`] = `21258`; + +exports[`datatype > seed: 1337 > float > should return a deterministic value for given number 5`] = `27810`; + +exports[`datatype > seed: 1337 > float() 1`] = `26202.2`; + +exports[`datatype > seed: 1337 > hexadecimal > should return a deterministic hex of given length 1`] = `"0x5c346ba075bd57F5A62B82d72AF39CBBB07a98cbA8"`; + +exports[`datatype > seed: 1337 > hexadecimal() 1`] = `"0x5"`; + +exports[`datatype > seed: 1337 > json() 1`] = `"{\\"foo\\":56052,\\"bar\\":21258,\\"bike\\":54308,\\"a\\":3397,\\"b\\":23538,\\"name\\":\\"X9@{:e=+kD\\",\\"prop\\":62850}"`; + +exports[`datatype > seed: 1337 > number > should return a deterministic value for given max 1`] = `18`; + +exports[`datatype > seed: 1337 > number > should return a deterministic value for given min 1`] = `26160`; + +exports[`datatype > seed: 1337 > number > should return a deterministic value for given min and max 1`] = `-13`; + +exports[`datatype > seed: 1337 > number > should return a deterministic value for given min, max and precision 1`] = `-12.92`; + +exports[`datatype > seed: 1337 > number > should return a deterministic value for given number 1`] = `1`; + +exports[`datatype > seed: 1337 > number > should return a deterministic value for given number 2`] = `3`; + +exports[`datatype > seed: 1337 > number > should return a deterministic value for given number 3`] = `1`; + +exports[`datatype > seed: 1337 > number > should return a deterministic value for given number 4`] = `1`; + +exports[`datatype > seed: 1337 > number > should return a deterministic value for given number 5`] = `1`; + +exports[`datatype > seed: 1337 > number() 1`] = `26202`; + +exports[`datatype > seed: 1337 > string > should return a deterministic string of given length 1`] = `"9U/4:SK$>6QX9@{:e=+kD)[B,e|/Jqjjj!BLGDWQgC"`; + +exports[`datatype > seed: 1337 > string() 1`] = `"9U/4:SK$>6"`; + +exports[`datatype > seed: 1337 > uuid() 1`] = `"48234870-5389-445f-8b41-c61a52bf27dc"`; diff --git a/test/__snapshots__/date.spec.ts.snap b/test/__snapshots__/date.spec.ts.snap new file mode 100644 index 00000000000..426df869354 --- /dev/null +++ b/test/__snapshots__/date.spec.ts.snap @@ -0,0 +1,223 @@ +// Vitest Snapshot v1 + +exports[`date > seed: 42 > between() > should return deterministic value between given real dates 1`] = `2021-03-15T19:30:57.091Z`; + +exports[`date > seed: 42 > between() > should return deterministic value between given string dates 1`] = `2021-03-15T19:30:57.091Z`; + +exports[`date > seed: 42 > betweens() > should return deterministic value betweens given dates 1`] = ` +[ + 2021-03-15T19:30:57.091Z, + 2021-04-09T17:05:10.406Z, + 2021-04-18T19:23:52.973Z, +] +`; + +exports[`date > seed: 42 > betweens() > should return deterministic value betweens given string dates 1`] = ` +[ + 2021-03-15T19:30:57.091Z, + 2021-04-09T17:05:10.406Z, + 2021-04-18T19:23:52.973Z, +] +`; + +exports[`date > seed: 42 > birthdate() > should return deterministic value birthdate by age 1`] = `1959-06-26T13:52:19.442Z`; + +exports[`date > seed: 42 > birthdate() > should return deterministic value birthdate by age mode 1`] = `1942-09-15T09:55:20.478Z`; + +exports[`date > seed: 42 > birthdate() > should return deterministic value birthdate by age range 1`] = `1941-12-15T14:59:26.122Z`; + +exports[`date > seed: 42 > birthdate() > should return deterministic value birthdate by default 1`] = `1943-08-06T10:03:17.283Z`; + +exports[`date > seed: 42 > birthdate() > should return deterministic value birthdate by year 1`] = `2000-05-16T22:59:36.513Z`; + +exports[`date > seed: 42 > birthdate() > should return deterministic value birthdate by year mode 1`] = `1943-08-06T10:03:17.283Z`; + +exports[`date > seed: 42 > birthdate() > should return deterministic value birthdate by year range 1`] = `1937-10-30T15:52:07.381Z`; + +exports[`date > seed: 42 > future() > should return deterministic future value on given refDate of type date 1`] = `2021-07-08T10:07:33.381Z`; + +exports[`date > seed: 42 > future() > should return deterministic future value on given refDate of type string 1`] = `2021-07-08T10:07:33.381Z`; + +exports[`date > seed: 42 > future() > should return deterministic future value on given years 10 and refDate of type date 1`] = `2024-11-19T18:52:06.785Z`; + +exports[`date > seed: 42 > future() > should return deterministic future value on given years 10 and refDate of type string 1`] = `2024-11-19T18:52:06.785Z`; + +exports[`date > seed: 42 > month() > should return deterministic value month by default 1`] = `"May"`; + +exports[`date > seed: 42 > month() > should return deterministic value month with abbr and context true 1`] = `"May"`; + +exports[`date > seed: 42 > month() > should return deterministic value month with abbr true 1`] = `"May"`; + +exports[`date > seed: 42 > month() > should return deterministic value month with context true 1`] = `"May"`; + +exports[`date > seed: 42 > past() > should return deterministic past value on given refDate of type date 1`] = `2020-10-08T00:10:58.041Z`; + +exports[`date > seed: 42 > past() > should return deterministic past value on given refDate of type string 1`] = `2020-10-08T00:10:58.041Z`; + +exports[`date > seed: 42 > past() > should return deterministic past value on given years 10 and refDate of type date 1`] = `2017-05-26T15:26:24.637Z`; + +exports[`date > seed: 42 > past() > should return deterministic past value on given years 10 and refDate of type string 1`] = `2017-05-26T15:26:24.637Z`; + +exports[`date > seed: 42 > recent() > should return deterministic value recent to given refDate of type date 1`] = `2021-02-21T08:11:56.820Z`; + +exports[`date > seed: 42 > recent() > should return deterministic value recent to given refDate of type string 1`] = `2021-02-21T08:11:56.820Z`; + +exports[`date > seed: 42 > soon() > should return deterministic value soon to given refDate of type date 1`] = `2021-03-13T23:15:38.042Z`; + +exports[`date > seed: 42 > soon() > should return deterministic value soon to given refDate of type string 1`] = `2021-03-13T23:15:38.042Z`; + +exports[`date > seed: 42 > weekday() > should return deterministic value weekday by default 1`] = `"Tuesday"`; + +exports[`date > seed: 42 > weekday() > should return deterministic value weekday with abbr and context true 1`] = `"Tue"`; + +exports[`date > seed: 42 > weekday() > should return deterministic value weekday with abbr true 1`] = `"Tue"`; + +exports[`date > seed: 42 > weekday() > should return deterministic value weekday with context true 1`] = `"Tuesday"`; + +exports[`date > seed: 1211 > between() > should return deterministic value between given real dates 1`] = `2021-04-17T11:58:13.327Z`; + +exports[`date > seed: 1211 > between() > should return deterministic value between given string dates 1`] = `2021-04-17T11:58:13.327Z`; + +exports[`date > seed: 1211 > betweens() > should return deterministic value betweens given dates 1`] = ` +[ + 2021-03-20T19:08:07.621Z, + 2021-04-15T10:20:25.794Z, + 2021-04-17T11:58:13.327Z, +] +`; + +exports[`date > seed: 1211 > betweens() > should return deterministic value betweens given string dates 1`] = ` +[ + 2021-03-20T19:08:07.621Z, + 2021-04-15T10:20:25.794Z, + 2021-04-17T11:58:13.327Z, +] +`; + +exports[`date > seed: 1211 > birthdate() > should return deterministic value birthdate by age 1`] = `1960-01-14T18:44:13.966Z`; + +exports[`date > seed: 1211 > birthdate() > should return deterministic value birthdate by age mode 1`] = `1977-08-10T01:09:17.468Z`; + +exports[`date > seed: 1211 > birthdate() > should return deterministic value birthdate by age range 1`] = `1975-10-01T07:11:50.190Z`; + +exports[`date > seed: 1211 > birthdate() > should return deterministic value birthdate by default 1`] = `1978-06-29T09:24:02.647Z`; + +exports[`date > seed: 1211 > birthdate() > should return deterministic value birthdate by year 1`] = `2000-12-04T01:16:03.286Z`; + +exports[`date > seed: 1211 > birthdate() > should return deterministic value birthdate by year mode 1`] = `1978-06-29T09:24:02.647Z`; + +exports[`date > seed: 1211 > birthdate() > should return deterministic value birthdate by year range 1`] = `1993-10-11T07:44:59.519Z`; + +exports[`date > seed: 1211 > future() > should return deterministic future value on given refDate of type date 1`] = `2022-01-26T14:59:27.351Z`; + +exports[`date > seed: 1211 > future() > should return deterministic future value on given refDate of type string 1`] = `2022-01-26T14:59:27.351Z`; + +exports[`date > seed: 1211 > future() > should return deterministic future value on given years 10 and refDate of type date 1`] = `2030-06-03T19:31:11.467Z`; + +exports[`date > seed: 1211 > future() > should return deterministic future value on given years 10 and refDate of type string 1`] = `2030-06-03T19:31:11.467Z`; + +exports[`date > seed: 1211 > month() > should return deterministic value month by default 1`] = `"December"`; + +exports[`date > seed: 1211 > month() > should return deterministic value month with abbr and context true 1`] = `"Dec"`; + +exports[`date > seed: 1211 > month() > should return deterministic value month with abbr true 1`] = `"Dec"`; + +exports[`date > seed: 1211 > month() > should return deterministic value month with context true 1`] = `"December"`; + +exports[`date > seed: 1211 > past() > should return deterministic past value on given refDate of type date 1`] = `2020-03-19T19:19:04.071Z`; + +exports[`date > seed: 1211 > past() > should return deterministic past value on given refDate of type string 1`] = `2020-03-19T19:19:04.071Z`; + +exports[`date > seed: 1211 > past() > should return deterministic past value on given years 10 and refDate of type date 1`] = `2011-11-12T14:47:19.955Z`; + +exports[`date > seed: 1211 > past() > should return deterministic past value on given years 10 and refDate of type string 1`] = `2011-11-12T14:47:19.955Z`; + +exports[`date > seed: 1211 > recent() > should return deterministic value recent to given refDate of type date 1`] = `2021-02-20T18:54:13.498Z`; + +exports[`date > seed: 1211 > recent() > should return deterministic value recent to given refDate of type string 1`] = `2021-02-20T18:54:13.498Z`; + +exports[`date > seed: 1211 > soon() > should return deterministic value soon to given refDate of type date 1`] = `2021-03-14T12:33:21.364Z`; + +exports[`date > seed: 1211 > soon() > should return deterministic value soon to given refDate of type string 1`] = `2021-03-14T12:33:21.364Z`; + +exports[`date > seed: 1211 > weekday() > should return deterministic value weekday by default 1`] = `"Saturday"`; + +exports[`date > seed: 1211 > weekday() > should return deterministic value weekday with abbr and context true 1`] = `"Sat"`; + +exports[`date > seed: 1211 > weekday() > should return deterministic value weekday with abbr true 1`] = `"Sat"`; + +exports[`date > seed: 1211 > weekday() > should return deterministic value weekday with context true 1`] = `"Saturday"`; + +exports[`date > seed: 1337 > between() > should return deterministic value between given real dates 1`] = `2021-03-09T04:11:24.667Z`; + +exports[`date > seed: 1337 > between() > should return deterministic value between given string dates 1`] = `2021-03-09T04:11:24.667Z`; + +exports[`date > seed: 1337 > betweens() > should return deterministic value betweens given dates 1`] = ` +[ + 2021-03-03T01:51:22.512Z, + 2021-03-09T04:11:24.667Z, + 2021-03-26T18:53:00.564Z, +] +`; + +exports[`date > seed: 1337 > betweens() > should return deterministic value betweens given string dates 1`] = ` +[ + 2021-03-03T01:51:22.512Z, + 2021-03-09T04:11:24.667Z, + 2021-03-26T18:53:00.564Z, +] +`; + +exports[`date > seed: 1337 > birthdate() > should return deterministic value birthdate by age 1`] = `1959-05-16T12:14:12.585Z`; + +exports[`date > seed: 1337 > birthdate() > should return deterministic value birthdate by age mode 1`] = `1935-08-14T07:41:47.183Z`; + +exports[`date > seed: 1337 > birthdate() > should return deterministic value birthdate by age range 1`] = `1935-02-03T18:44:07.874Z`; + +exports[`date > seed: 1337 > birthdate() > should return deterministic value birthdate by default 1`] = `1936-07-04T15:55:47.989Z`; + +exports[`date > seed: 1337 > birthdate() > should return deterministic value birthdate by year 1`] = `2000-04-06T02:45:32.324Z`; + +exports[`date > seed: 1337 > birthdate() > should return deterministic value birthdate by year mode 1`] = `1936-07-04T15:55:47.989Z`; + +exports[`date > seed: 1337 > birthdate() > should return deterministic value birthdate by year range 1`] = `1926-06-20T07:18:05.539Z`; + +exports[`date > seed: 1337 > future() > should return deterministic future value on given refDate of type date 1`] = `2021-05-28T08:29:26.637Z`; + +exports[`date > seed: 1337 > future() > should return deterministic future value on given refDate of type string 1`] = `2021-05-28T08:29:26.637Z`; + +exports[`date > seed: 1337 > future() > should return deterministic future value on given years 10 and refDate of type date 1`] = `2023-10-06T02:30:58.333Z`; + +exports[`date > seed: 1337 > future() > should return deterministic future value on given years 10 and refDate of type string 1`] = `2023-10-06T02:30:58.333Z`; + +exports[`date > seed: 1337 > month() > should return deterministic value month by default 1`] = `"April"`; + +exports[`date > seed: 1337 > month() > should return deterministic value month with abbr and context true 1`] = `"Apr"`; + +exports[`date > seed: 1337 > month() > should return deterministic value month with abbr true 1`] = `"Apr"`; + +exports[`date > seed: 1337 > month() > should return deterministic value month with context true 1`] = `"April"`; + +exports[`date > seed: 1337 > past() > should return deterministic past value on given refDate of type date 1`] = `2020-11-18T01:49:04.785Z`; + +exports[`date > seed: 1337 > past() > should return deterministic past value on given refDate of type string 1`] = `2020-11-18T01:49:04.785Z`; + +exports[`date > seed: 1337 > past() > should return deterministic past value on given years 10 and refDate of type date 1`] = `2018-07-11T07:47:33.089Z`; + +exports[`date > seed: 1337 > past() > should return deterministic past value on given years 10 and refDate of type string 1`] = `2018-07-11T07:47:33.089Z`; + +exports[`date > seed: 1337 > recent() > should return deterministic value recent to given refDate of type date 1`] = `2021-02-21T10:53:58.041Z`; + +exports[`date > seed: 1337 > recent() > should return deterministic value recent to given refDate of type string 1`] = `2021-02-21T10:53:58.041Z`; + +exports[`date > seed: 1337 > soon() > should return deterministic value soon to given refDate of type date 1`] = `2021-03-13T20:33:36.821Z`; + +exports[`date > seed: 1337 > soon() > should return deterministic value soon to given refDate of type string 1`] = `2021-03-13T20:33:36.821Z`; + +exports[`date > seed: 1337 > weekday() > should return deterministic value weekday by default 1`] = `"Monday"`; + +exports[`date > seed: 1337 > weekday() > should return deterministic value weekday with abbr and context true 1`] = `"Mon"`; + +exports[`date > seed: 1337 > weekday() > should return deterministic value weekday with abbr true 1`] = `"Mon"`; + +exports[`date > seed: 1337 > weekday() > should return deterministic value weekday with context true 1`] = `"Monday"`; diff --git a/test/__snapshots__/finance.spec.ts.snap b/test/__snapshots__/finance.spec.ts.snap new file mode 100644 index 00000000000..0acc368d3e3 --- /dev/null +++ b/test/__snapshots__/finance.spec.ts.snap @@ -0,0 +1,109 @@ +// Vitest Snapshot v1 + +exports[`finance > seed: 42 > account() 1`] = `"37917755"`; + +exports[`finance > seed: 42 > accountName() 1`] = `"Money Market Account"`; + +exports[`finance > seed: 42 > amount() 1`] = `"374.54"`; + +exports[`finance > seed: 42 > bic() 1`] = `"UYEOSCP1514"`; + +exports[`finance > seed: 42 > bitcoinAddress() 1`] = `"3XbJMAAara64sSkA9HD24YHQWd1b"`; + +exports[`finance > seed: 42 > creditCardCVV() 1`] = `"379"`; + +exports[`finance > seed: 42 > creditCardNumber() 1`] = `"3581-7755-1410-0484"`; + +exports[`finance > seed: 42 > currencyCode() 1`] = `"IQD"`; + +exports[`finance > seed: 42 > currencyName() 1`] = `"Iraqi Dinar"`; + +exports[`finance > seed: 42 > currencySymbol() 1`] = `"โ‚ฑ"`; + +exports[`finance > seed: 42 > ethereumAddress() 1`] = `"0x8be4abdd39321ad7d3fe01ffce404f4d6db0906b"`; + +exports[`finance > seed: 42 > iban() 1`] = `"GT30Y75110867098F1E3542612J4"`; + +exports[`finance > seed: 42 > litecoinAddress() 1`] = `"3XbJMAAara64sSkA9HD24YHQWd1b"`; + +exports[`finance > seed: 42 > mask() 1`] = `"(...3791)"`; + +exports[`finance > seed: 42 > pin() 1`] = `"3791"`; + +exports[`finance > seed: 42 > routingNumber() 1`] = `"379177554"`; + +exports[`finance > seed: 42 > transactionDescription() 1`] = `"invoice transaction at Wiegand, Deckow and Renner using card ending with ***(...8361) for SDG 374.54 in account ***55141004"`; + +exports[`finance > seed: 42 > transactionType() 1`] = `"withdrawal"`; + +exports[`finance > seed: 1211 > account() 1`] = `"94872190"`; + +exports[`finance > seed: 1211 > accountName() 1`] = `"Personal Loan Account"`; + +exports[`finance > seed: 1211 > amount() 1`] = `"928.52"`; + +exports[`finance > seed: 1211 > bic() 1`] = `"LXUEBTZ1"`; + +exports[`finance > seed: 1211 > bitcoinAddress() 1`] = `"1TMe8Z3EaFdLqmaGKP1LEEJQVriSZRZdsA"`; + +exports[`finance > seed: 1211 > creditCardCVV() 1`] = `"948"`; + +exports[`finance > seed: 1211 > creditCardNumber() 1`] = `"4872190616274"`; + +exports[`finance > seed: 1211 > currencyCode() 1`] = `"XDR"`; + +exports[`finance > seed: 1211 > currencyName() 1`] = `"SDR"`; + +exports[`finance > seed: 1211 > currencySymbol() 1`] = `"โ‚ญ"`; + +exports[`finance > seed: 1211 > ethereumAddress() 1`] = `"0xeadb42f0e3f4a973fab0aeefce96dfcf49cd438d"`; + +exports[`finance > seed: 1211 > iban() 1`] = `"TN0382001124170679299069"`; + +exports[`finance > seed: 1211 > litecoinAddress() 1`] = `"MTMe8Z3EaFdLqmaGKP1LEEJQVriSZRZds"`; + +exports[`finance > seed: 1211 > mask() 1`] = `"(...9487)"`; + +exports[`finance > seed: 1211 > pin() 1`] = `"9487"`; + +exports[`finance > seed: 1211 > routingNumber() 1`] = `"948721904"`; + +exports[`finance > seed: 1211 > transactionDescription() 1`] = `"deposit transaction at Trantow - Sanford using card ending with ***(...4316) for STN 928.52 in account ***19061627"`; + +exports[`finance > seed: 1211 > transactionType() 1`] = `"invoice"`; + +exports[`finance > seed: 1337 > account() 1`] = `"25122540"`; + +exports[`finance > seed: 1337 > accountName() 1`] = `"Money Market Account"`; + +exports[`finance > seed: 1337 > amount() 1`] = `"262.02"`; + +exports[`finance > seed: 1337 > bic() 1`] = `"OEFELYL1032"`; + +exports[`finance > seed: 1337 > bitcoinAddress() 1`] = `"3adhxs2jewAgkYgJi7No6Cn8JZa"`; + +exports[`finance > seed: 1337 > creditCardCVV() 1`] = `"251"`; + +exports[`finance > seed: 1337 > creditCardNumber() 1`] = `"6011-6212-2540-3255-2398"`; + +exports[`finance > seed: 1337 > currencyCode() 1`] = `"FJD"`; + +exports[`finance > seed: 1337 > currencyName() 1`] = `"Fiji Dollar"`; + +exports[`finance > seed: 1337 > currencySymbol() 1`] = `"$"`; + +exports[`finance > seed: 1337 > ethereumAddress() 1`] = `"0x5c346ba075bd57f5a62b82d72af39cbbb07a98cb"`; + +exports[`finance > seed: 1337 > iban() 1`] = `"FO7710540350900318"`; + +exports[`finance > seed: 1337 > litecoinAddress() 1`] = `"Madhxs2jewAgkYgJi7No6Cn8JZar"`; + +exports[`finance > seed: 1337 > mask() 1`] = `"(...2512)"`; + +exports[`finance > seed: 1337 > pin() 1`] = `"2512"`; + +exports[`finance > seed: 1337 > routingNumber() 1`] = `"251225401"`; + +exports[`finance > seed: 1337 > transactionDescription() 1`] = `"withdrawal transaction at Cronin - Effertz using card ending with ***(...3927) for GTQ 262.02 in account ***54032552"`; + +exports[`finance > seed: 1337 > transactionType() 1`] = `"withdrawal"`; diff --git a/test/__snapshots__/git.spec.ts.snap b/test/__snapshots__/git.spec.ts.snap new file mode 100644 index 00000000000..11b82fbe686 --- /dev/null +++ b/test/__snapshots__/git.spec.ts.snap @@ -0,0 +1,25 @@ +// Vitest Snapshot v1 + +exports[`git > seed: 42 > branch() 1`] = `"array-transmit"`; + +exports[`git > seed: 42 > commitMessage() 1`] = `"navigate neural capacitor"`; + +exports[`git > seed: 42 > commitSha() 1`] = `"5cf2bc99272107d592ba00fbdf302f2949806048"`; + +exports[`git > seed: 42 > shortSha() 1`] = `"5cf2bc9"`; + +exports[`git > seed: 1211 > branch() 1`] = `"capacitor-connect"`; + +exports[`git > seed: 1211 > commitMessage() 1`] = `"reboot online circuit"`; + +exports[`git > seed: 1211 > commitSha() 1`] = `"e7ec32f0a2a3c652bbd0caabde64dfdf379e3259"`; + +exports[`git > seed: 1211 > shortSha() 1`] = `"e7ec32f"`; + +exports[`git > seed: 1337 > branch() 1`] = `"port-quantify"`; + +exports[`git > seed: 1337 > commitMessage() 1`] = `"compress multi-byte panel"`; + +exports[`git > seed: 1337 > commitSha() 1`] = `"48234870538945f4b41c61a52bf27dccc0576698"`; + +exports[`git > seed: 1337 > shortSha() 1`] = `"4823487"`; diff --git a/test/__snapshots__/hacker.spec.ts.snap b/test/__snapshots__/hacker.spec.ts.snap new file mode 100644 index 00000000000..b58c10a9bf9 --- /dev/null +++ b/test/__snapshots__/hacker.spec.ts.snap @@ -0,0 +1,37 @@ +// Vitest Snapshot v1 + +exports[`name > seed: 42 > abbreviation() 1`] = `"PCI"`; + +exports[`name > seed: 42 > adjective() 1`] = `"cross-platform"`; + +exports[`name > seed: 42 > ingverb() 1`] = `"copying"`; + +exports[`name > seed: 42 > noun() 1`] = `"array"`; + +exports[`name > seed: 42 > phrase() 1`] = `"Try to transmit the SAS microchip, maybe it will quantify the mobile monitor!"`; + +exports[`name > seed: 42 > verb() 1`] = `"navigate"`; + +exports[`name > seed: 1211 > abbreviation() 1`] = `"JSON"`; + +exports[`name > seed: 1211 > adjective() 1`] = `"solid state"`; + +exports[`name > seed: 1211 > ingverb() 1`] = `"programming"`; + +exports[`name > seed: 1211 > noun() 1`] = `"capacitor"`; + +exports[`name > seed: 1211 > phrase() 1`] = `"I'll back up the neural RSS program, that should panel the SCSI matrix!"`; + +exports[`name > seed: 1211 > verb() 1`] = `"reboot"`; + +exports[`name > seed: 1337 > abbreviation() 1`] = `"AGP"`; + +exports[`name > seed: 1337 > adjective() 1`] = `"open-source"`; + +exports[`name > seed: 1337 > ingverb() 1`] = `"compressing"`; + +exports[`name > seed: 1337 > noun() 1`] = `"port"`; + +exports[`name > seed: 1337 > phrase() 1`] = `"Try to generate the COM program, maybe it will connect the back-end port!"`; + +exports[`name > seed: 1337 > verb() 1`] = `"compress"`; diff --git a/test/__snapshots__/helpers.spec.ts.snap b/test/__snapshots__/helpers.spec.ts.snap new file mode 100644 index 00000000000..3c5b3aeff4e --- /dev/null +++ b/test/__snapshots__/helpers.spec.ts.snap @@ -0,0 +1,55 @@ +// Vitest Snapshot v1 + +exports[`helpers > seed: 42 > mustache() 1`] = `""`; + +exports[`helpers > seed: 42 > regexpStyleStringParse() 1`] = `""`; + +exports[`helpers > seed: 42 > repeatString() 1`] = `""`; + +exports[`helpers > seed: 42 > replaceCreditCardSymbols() 1`] = `"6453-3791-7755-1410-0489"`; + +exports[`helpers > seed: 42 > replaceSymbolWithNumber() 1`] = `""`; + +exports[`helpers > seed: 42 > replaceSymbols() 1`] = `""`; + +exports[`helpers > seed: 42 > shuffle() 1`] = `[]`; + +exports[`helpers > seed: 42 > slugify() 1`] = `""`; + +exports[`helpers > seed: 42 > uniqueArray() 1`] = `[]`; + +exports[`helpers > seed: 1211 > mustache() 1`] = `""`; + +exports[`helpers > seed: 1211 > regexpStyleStringParse() 1`] = `""`; + +exports[`helpers > seed: 1211 > repeatString() 1`] = `""`; + +exports[`helpers > seed: 1211 > replaceCreditCardSymbols() 1`] = `"6453-9487-2190-6162-7434"`; + +exports[`helpers > seed: 1211 > replaceSymbolWithNumber() 1`] = `""`; + +exports[`helpers > seed: 1211 > replaceSymbols() 1`] = `""`; + +exports[`helpers > seed: 1211 > shuffle() 1`] = `[]`; + +exports[`helpers > seed: 1211 > slugify() 1`] = `""`; + +exports[`helpers > seed: 1211 > uniqueArray() 1`] = `[]`; + +exports[`helpers > seed: 1337 > mustache() 1`] = `""`; + +exports[`helpers > seed: 1337 > regexpStyleStringParse() 1`] = `""`; + +exports[`helpers > seed: 1337 > repeatString() 1`] = `""`; + +exports[`helpers > seed: 1337 > replaceCreditCardSymbols() 1`] = `"6453-2512-2540-3255-2399"`; + +exports[`helpers > seed: 1337 > replaceSymbolWithNumber() 1`] = `""`; + +exports[`helpers > seed: 1337 > replaceSymbols() 1`] = `""`; + +exports[`helpers > seed: 1337 > shuffle() 1`] = `[]`; + +exports[`helpers > seed: 1337 > slugify() 1`] = `""`; + +exports[`helpers > seed: 1337 > uniqueArray() 1`] = `[]`; diff --git a/test/__snapshots__/internet.spec.ts.snap b/test/__snapshots__/internet.spec.ts.snap new file mode 100644 index 00000000000..4ff73c9c151 --- /dev/null +++ b/test/__snapshots__/internet.spec.ts.snap @@ -0,0 +1,115 @@ +// Vitest Snapshot v1 + +exports[`internet > seed: 42 > avatar() 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/468.jpg"`; + +exports[`internet > seed: 42 > color() 1`] = `"#30667a"`; + +exports[`internet > seed: 42 > domainName() 1`] = `"harmonious-shift.org"`; + +exports[`internet > seed: 42 > domainSuffix() 1`] = `"info"`; + +exports[`internet > seed: 42 > domainWord() 1`] = `"harmonious-shift"`; + +exports[`internet > seed: 42 > email() 1`] = `"Peyton73@yahoo.com"`; + +exports[`internet > seed: 42 > emoji() 1`] = `"๐Ÿ•ธ๏ธ"`; + +exports[`internet > seed: 42 > exampleEmail() 1`] = `"Peyton73@example.com"`; + +exports[`internet > seed: 42 > httpMethod() 1`] = `"POST"`; + +exports[`internet > seed: 42 > httpStatusCode() 1`] = `207`; + +exports[`internet > seed: 42 > ip() 1`] = `"95.203.243.46"`; + +exports[`internet > seed: 42 > ipv6() 1`] = `"5cf2:bc99:2721:07d5:92ba:00fb:df30:2f29"`; + +exports[`internet > seed: 42 > mac() 1`] = `"5c:f2:bc:99:27:21"`; + +exports[`internet > seed: 42 > password() 1`] = `"Dl2fkYYKLsZdepz"`; + +exports[`internet > seed: 42 > port() 1`] = `24545`; + +exports[`internet > seed: 42 > protocol() 1`] = `"http"`; + +exports[`internet > seed: 42 > url() 1`] = `"http://stable-vehicle.biz"`; + +exports[`internet > seed: 42 > userAgent() 1`] = `"Mozilla/5.0 (Windows; U; Windows NT 6.2) AppleWebKit/538.0.2 (KHTML, like Gecko) Chrome/29.0.815.0 Safari/538.0.2"`; + +exports[`internet > seed: 42 > userName() 1`] = `"Garnett.Schinner73"`; + +exports[`internet > seed: 1211 > avatar() 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1160.jpg"`; + +exports[`internet > seed: 1211 > color() 1`] = `"#773a72"`; + +exports[`internet > seed: 1211 > domainName() 1`] = `"verifiable-infection.org"`; + +exports[`internet > seed: 1211 > domainSuffix() 1`] = `"org"`; + +exports[`internet > seed: 1211 > domainWord() 1`] = `"verifiable-infection"`; + +exports[`internet > seed: 1211 > email() 1`] = `"Jadon.Trantow12@hotmail.com"`; + +exports[`internet > seed: 1211 > emoji() 1`] = `"๐Ÿ‡ฎ๐Ÿ‡ธ"`; + +exports[`internet > seed: 1211 > exampleEmail() 1`] = `"Jadon.Trantow12@example.net"`; + +exports[`internet > seed: 1211 > httpMethod() 1`] = `"PATCH"`; + +exports[`internet > seed: 1211 > httpStatusCode() 1`] = `505`; + +exports[`internet > seed: 1211 > ip() 1`] = `"237.117.228.199"`; + +exports[`internet > seed: 1211 > ipv6() 1`] = `"e7ec:32f0:a2a3:c652:bbd0:caab:de64:dfdf"`; + +exports[`internet > seed: 1211 > mac() 1`] = `"e7:ec:32:f0:a2:a3"`; + +exports[`internet > seed: 1211 > password() 1`] = `"yLuj60b5iHB0bhn"`; + +exports[`internet > seed: 1211 > port() 1`] = `60851`; + +exports[`internet > seed: 1211 > protocol() 1`] = `"https"`; + +exports[`internet > seed: 1211 > url() 1`] = `"https://joyous-temperature.net"`; + +exports[`internet > seed: 1211 > userAgent() 1`] = `"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6 rv:3.0; PT) AppleWebKit/538.2.0 (KHTML, like Gecko) Version/4.1.0 Safari/538.2.0"`; + +exports[`internet > seed: 1211 > userName() 1`] = `"Tito_Koch22"`; + +exports[`internet > seed: 1337 > avatar() 1`] = `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/327.jpg"`; + +exports[`internet > seed: 1337 > color() 1`] = `"#214814"`; + +exports[`internet > seed: 1337 > domainName() 1`] = `"fabulous-might.com"`; + +exports[`internet > seed: 1337 > domainSuffix() 1`] = `"biz"`; + +exports[`internet > seed: 1337 > domainWord() 1`] = `"fabulous-might"`; + +exports[`internet > seed: 1337 > email() 1`] = `"Keith27@gmail.com"`; + +exports[`internet > seed: 1337 > emoji() 1`] = `"๐Ÿ’‡๐Ÿผโ€โ™€๏ธ"`; + +exports[`internet > seed: 1337 > exampleEmail() 1`] = `"Keith27@example.org"`; + +exports[`internet > seed: 1337 > httpMethod() 1`] = `"POST"`; + +exports[`internet > seed: 1337 > httpStatusCode() 1`] = `205`; + +exports[`internet > seed: 1337 > ip() 1`] = `"67.143.40.54"`; + +exports[`internet > seed: 1337 > ipv6() 1`] = `"4823:4870:5389:45f4:b41c:61a5:2bf2:7dcc"`; + +exports[`internet > seed: 1337 > mac() 1`] = `"48:23:48:70:53:89"`; + +exports[`internet > seed: 1337 > password() 1`] = `"9V05TL7RY9fmECg"`; + +exports[`internet > seed: 1337 > port() 1`] = `17172`; + +exports[`internet > seed: 1337 > protocol() 1`] = `"http"`; + +exports[`internet > seed: 1337 > url() 1`] = `"http://neat-chopsticks.biz"`; + +exports[`internet > seed: 1337 > userAgent() 1`] = `"Mozilla/5.0 (Windows; U; Windows NT 6.1) AppleWebKit/532.0.0 (KHTML, like Gecko) Chrome/13.0.832.0 Safari/532.0.0"`; + +exports[`internet > seed: 1337 > userName() 1`] = `"Devyn21"`; diff --git a/test/__snapshots__/lorem.spec.ts.snap b/test/__snapshots__/lorem.spec.ts.snap new file mode 100644 index 00000000000..e9ecfc5ab69 --- /dev/null +++ b/test/__snapshots__/lorem.spec.ts.snap @@ -0,0 +1,83 @@ +// Vitest Snapshot v1 + +exports[`lorem > seed: 42 > lines() 1`] = ` +"Hic sit minus dolor animi mollitia sequi ducimus sequi. +Inventore praesentium et." +`; + +exports[`lorem > seed: 42 > paragraph() 1`] = `"Hic sit minus dolor animi mollitia sequi ducimus sequi. Inventore praesentium et. Animi qui impedit et voluptatem. Ut quisquam fugiat."`; + +exports[`lorem > seed: 42 > paragraphs() 1`] = ` +"Hic sit minus dolor animi mollitia sequi ducimus sequi. Inventore praesentium et. Animi qui impedit et voluptatem. Ut quisquam fugiat. +Alias sit asperiores sit. Corporis laborum cupiditate consequatur et voluptatem nostrum. Laborum in eos quae nostrum aut consequatur. Blanditiis sunt repellendus et. Eum sint voluptatibus deserunt. Quae eos est soluta ipsum qui. +Hic earum delectus. Consequatur eum corporis perferendis aspernatur incidunt nobis. Odio nobis quia est." +`; + +exports[`lorem > seed: 42 > sentence() 1`] = `"Quibusdam hic sit minus dolor."`; + +exports[`lorem > seed: 42 > sentences() 1`] = `"Hic sit minus dolor animi mollitia sequi ducimus sequi. Inventore praesentium et. Animi qui impedit et voluptatem."`; + +exports[`lorem > seed: 42 > slug() 1`] = `"autem-quibusdam-hic"`; + +exports[`lorem > seed: 42 > text() 1`] = `"Hic sit minus dolor animi mollitia sequi ducimus sequi."`; + +exports[`lorem > seed: 42 > word() 1`] = `"autem"`; + +exports[`lorem > seed: 42 > words() 1`] = `"autem quibusdam hic"`; + +exports[`lorem > seed: 1211 > lines() 1`] = ` +"Saepe omnis tempora magni repellat eaque. +Nesciunt nobis non voluptas quam ex neque eligendi. +Vel perferendis assumenda nam expedita est eum molestiae. +Ullam et maiores vero doloribus eius. +Officia et velit voluptatem quis dolorum." +`; + +exports[`lorem > seed: 1211 > paragraph() 1`] = `"Saepe omnis tempora magni repellat eaque. Nesciunt nobis non voluptas quam ex neque eligendi. Vel perferendis assumenda nam expedita est eum molestiae. Ullam et maiores vero doloribus eius. Officia et velit voluptatem quis dolorum. Dignissimos voluptas aut qui corporis itaque sit provident quam aut."`; + +exports[`lorem > seed: 1211 > paragraphs() 1`] = ` +"Saepe omnis tempora magni repellat eaque. Nesciunt nobis non voluptas quam ex neque eligendi. Vel perferendis assumenda nam expedita est eum molestiae. Ullam et maiores vero doloribus eius. Officia et velit voluptatem quis dolorum. Dignissimos voluptas aut qui corporis itaque sit provident quam aut. +In ullam quia impedit. Occaecati repudiandae ut maiores pariatur enim. Deserunt voluptatem in enim in quia. +Ut eligendi tempora eos ipsa cumque nulla. Quidem et sed voluptate et quia. Nulla esse in similique deleniti beatae eaque." +`; + +exports[`lorem > seed: 1211 > sentence() 1`] = `"Praesentium saepe omnis tempora magni repellat eaque tempore nesciunt nobis."`; + +exports[`lorem > seed: 1211 > sentences() 1`] = `"Saepe omnis tempora magni repellat eaque. Nesciunt nobis non voluptas quam ex neque eligendi. Vel perferendis assumenda nam expedita est eum molestiae. Ullam et maiores vero doloribus eius. Officia et velit voluptatem quis dolorum. Dignissimos voluptas aut qui corporis itaque sit provident quam aut."`; + +exports[`lorem > seed: 1211 > slug() 1`] = `"non-praesentium-saepe"`; + +exports[`lorem > seed: 1211 > text() 1`] = ` +"Omnis tempora magni repellat eaque tempore nesciunt nobis non voluptas. +Ex neque eligendi placeat vel perferendis. +Nam expedita est eum molestiae iusto ullam et maiores." +`; + +exports[`lorem > seed: 1211 > word() 1`] = `"non"`; + +exports[`lorem > seed: 1211 > words() 1`] = `"non praesentium saepe"`; + +exports[`lorem > seed: 1337 > lines() 1`] = ` +"Nesciunt non minima perspiciatis praesentium aperiam voluptatem. +Occaecati deserunt voluptatem suscipit." +`; + +exports[`lorem > seed: 1337 > paragraph() 1`] = `"Nesciunt non minima perspiciatis praesentium aperiam voluptatem. Occaecati deserunt voluptatem suscipit. Enim minus nemo fugit et iure explicabo et commodi consequuntur. Voluptatibus nesciunt dignissimos eos temporibus temporibus autem consequatur."`; + +exports[`lorem > seed: 1337 > paragraphs() 1`] = ` +"Nesciunt non minima perspiciatis praesentium aperiam voluptatem. Occaecati deserunt voluptatem suscipit. Enim minus nemo fugit et iure explicabo et commodi consequuntur. Voluptatibus nesciunt dignissimos eos temporibus temporibus autem consequatur. +Esse vel qui occaecati omnis quis. Voluptatum quis et libero. Et odio dolor qui velit qui. Eveniet provident non fugiat. +A a aut nihil. Quas eligendi excepturi eligendi perferendis quo minus et asperiores. Neque blanditiis consequuntur esse autem harum eligendi aut. Cum consequatur pariatur. Omnis temporibus sapiente." +`; + +exports[`lorem > seed: 1337 > sentence() 1`] = `"Natus nesciunt non minima perspiciatis."`; + +exports[`lorem > seed: 1337 > sentences() 1`] = `"Nesciunt non minima perspiciatis praesentium aperiam voluptatem. Occaecati deserunt voluptatem suscipit. Enim minus nemo fugit et iure explicabo et commodi consequuntur."`; + +exports[`lorem > seed: 1337 > slug() 1`] = `"voluptatem-natus-nesciunt"`; + +exports[`lorem > seed: 1337 > text() 1`] = `"natus nesciunt non"`; + +exports[`lorem > seed: 1337 > word() 1`] = `"voluptatem"`; + +exports[`lorem > seed: 1337 > words() 1`] = `"voluptatem natus nesciunt"`; diff --git a/test/__snapshots__/mersenne.spec.ts.snap b/test/__snapshots__/mersenne.spec.ts.snap new file mode 100644 index 00000000000..1c221b19624 --- /dev/null +++ b/test/__snapshots__/mersenne.spec.ts.snap @@ -0,0 +1,49 @@ +// Vitest Snapshot v1 + +exports[`mersenne twister > seed: [42,1,2] > rand() 1`] = `28056`; + +exports[`mersenne twister > seed: [42,1,2] > should return deterministic values for rand(100, 0) 1`] = `85`; + +exports[`mersenne twister > seed: [42,1,2] > should return deterministic values for rand(100, undefined) 1`] = `85`; + +exports[`mersenne twister > seed: [42,1,2] > should return deterministic values for rand(undefined, 0) 1`] = `28056`; + +exports[`mersenne twister > seed: [1211,1,2] > rand() 1`] = `29217`; + +exports[`mersenne twister > seed: [1211,1,2] > should return deterministic values for rand(100, 0) 1`] = `89`; + +exports[`mersenne twister > seed: [1211,1,2] > should return deterministic values for rand(100, undefined) 1`] = `89`; + +exports[`mersenne twister > seed: [1211,1,2] > should return deterministic values for rand(undefined, 0) 1`] = `29217`; + +exports[`mersenne twister > seed: [1337,1,2] > rand() 1`] = `5895`; + +exports[`mersenne twister > seed: [1337,1,2] > should return deterministic values for rand(100, 0) 1`] = `17`; + +exports[`mersenne twister > seed: [1337,1,2] > should return deterministic values for rand(100, undefined) 1`] = `17`; + +exports[`mersenne twister > seed: [1337,1,2] > should return deterministic values for rand(undefined, 0) 1`] = `5895`; + +exports[`mersenne twister > seed: 42 > rand() 1`] = `12272`; + +exports[`mersenne twister > seed: 42 > should return deterministic values for rand(100, 0) 1`] = `37`; + +exports[`mersenne twister > seed: 42 > should return deterministic values for rand(100, undefined) 1`] = `37`; + +exports[`mersenne twister > seed: 42 > should return deterministic values for rand(undefined, 0) 1`] = `12272`; + +exports[`mersenne twister > seed: 1211 > rand() 1`] = `30425`; + +exports[`mersenne twister > seed: 1211 > should return deterministic values for rand(100, 0) 1`] = `92`; + +exports[`mersenne twister > seed: 1211 > should return deterministic values for rand(100, undefined) 1`] = `92`; + +exports[`mersenne twister > seed: 1211 > should return deterministic values for rand(undefined, 0) 1`] = `30425`; + +exports[`mersenne twister > seed: 1337 > rand() 1`] = `8586`; + +exports[`mersenne twister > seed: 1337 > should return deterministic values for rand(100, 0) 1`] = `26`; + +exports[`mersenne twister > seed: 1337 > should return deterministic values for rand(100, undefined) 1`] = `26`; + +exports[`mersenne twister > seed: 1337 > should return deterministic values for rand(undefined, 0) 1`] = `8586`; diff --git a/test/__snapshots__/music.spec.ts.snap b/test/__snapshots__/music.spec.ts.snap new file mode 100644 index 00000000000..7ae987ec79c --- /dev/null +++ b/test/__snapshots__/music.spec.ts.snap @@ -0,0 +1,13 @@ +// Vitest Snapshot v1 + +exports[`music > seed: 42 > genre() 1`] = `"Country"`; + +exports[`music > seed: 42 > songName() 1`] = `"Only The Lonely (Know The Way I Feel)"`; + +exports[`music > seed: 1211 > genre() 1`] = `"Non Music"`; + +exports[`music > seed: 1211 > songName() 1`] = `"The End of the World"`; + +exports[`music > seed: 1337 > genre() 1`] = `"Folk"`; + +exports[`music > seed: 1337 > songName() 1`] = `"Turn! Turn! Turn! (To Everything There is a Season)"`; diff --git a/test/__snapshots__/name.spec.ts.snap b/test/__snapshots__/name.spec.ts.snap new file mode 100644 index 00000000000..577535f1e3b --- /dev/null +++ b/test/__snapshots__/name.spec.ts.snap @@ -0,0 +1,67 @@ +// Vitest Snapshot v1 + +exports[`name > seed: 42 > findName() 1`] = `"Sadie Wiegand"`; + +exports[`name > seed: 42 > firstName() 1`] = `"Garnett"`; + +exports[`name > seed: 42 > gender() 1`] = `"Cis"`; + +exports[`name > seed: 42 > jobArea() 1`] = `"Identity"`; + +exports[`name > seed: 42 > jobDescriptor() 1`] = `"Regional"`; + +exports[`name > seed: 42 > jobTitle() 1`] = `"Regional Data Representative"`; + +exports[`name > seed: 42 > jobType() 1`] = `"Coordinator"`; + +exports[`name > seed: 42 > lastName() 1`] = `"Hintz"`; + +exports[`name > seed: 42 > middleName() 1`] = `"Greer"`; + +exports[`name > seed: 42 > prefix() 1`] = `"Mrs."`; + +exports[`name > seed: 42 > suffix() 1`] = `"III"`; + +exports[`name > seed: 1211 > findName() 1`] = `"Claude Trantow"`; + +exports[`name > seed: 1211 > firstName() 1`] = `"Tito"`; + +exports[`name > seed: 1211 > gender() 1`] = `"Transexual Person"`; + +exports[`name > seed: 1211 > jobArea() 1`] = `"Factors"`; + +exports[`name > seed: 1211 > jobDescriptor() 1`] = `"Chief"`; + +exports[`name > seed: 1211 > jobTitle() 1`] = `"Chief Division Agent"`; + +exports[`name > seed: 1211 > jobType() 1`] = `"Representative"`; + +exports[`name > seed: 1211 > lastName() 1`] = `"Ward"`; + +exports[`name > seed: 1211 > middleName() 1`] = `"Sawyer"`; + +exports[`name > seed: 1211 > prefix() 1`] = `"Dr."`; + +exports[`name > seed: 1211 > suffix() 1`] = `"DVM"`; + +exports[`name > seed: 1337 > findName() 1`] = `"Leona Cronin"`; + +exports[`name > seed: 1337 > firstName() 1`] = `"Devyn"`; + +exports[`name > seed: 1337 > gender() 1`] = `"Two* person"`; + +exports[`name > seed: 1337 > jobArea() 1`] = `"Functionality"`; + +exports[`name > seed: 1337 > jobDescriptor() 1`] = `"Future"`; + +exports[`name > seed: 1337 > jobTitle() 1`] = `"Future Infrastructure Liaison"`; + +exports[`name > seed: 1337 > jobType() 1`] = `"Engineer"`; + +exports[`name > seed: 1337 > lastName() 1`] = `"Gibson"`; + +exports[`name > seed: 1337 > middleName() 1`] = `"Dakota"`; + +exports[`name > seed: 1337 > prefix() 1`] = `"Mrs."`; + +exports[`name > seed: 1337 > suffix() 1`] = `"I"`; diff --git a/test/__snapshots__/phone.spec.ts.snap b/test/__snapshots__/phone.spec.ts.snap new file mode 100644 index 00000000000..5c66e04156a --- /dev/null +++ b/test/__snapshots__/phone.spec.ts.snap @@ -0,0 +1,55 @@ +// Vitest Snapshot v1 + +exports[`phone > seed: 42 > imei() 1`] = `"37-917755-141004-5"`; + +exports[`phone > seed: 42 > number() 1`] = `"891.775.5141"`; + +exports[`phone > seed: 42 > phoneFormats() 1`] = `"!##.!##.####"`; + +exports[`phone > seed: 42 > phoneNumber() 1`] = `"891.775.5141"`; + +exports[`phone > seed: 42 > phoneNumberFormat > should return deterministic values for 1 1`] = `"(479) 377-5514"`; + +exports[`phone > seed: 42 > phoneNumberFormat > should return deterministic values for 2 1`] = `"1-479-377-5514"`; + +exports[`phone > seed: 42 > phoneNumberFormat > should return deterministic values for 3 1`] = `"479.377.5514"`; + +exports[`phone > seed: 42 > phoneNumberFormat > should return deterministic values for 4 1`] = `"479-377-5514"`; + +exports[`phone > seed: 42 > phoneNumberFormat() 1`] = `"479-377-5514"`; + +exports[`phone > seed: 1211 > imei() 1`] = `"94-872190-616274-4"`; + +exports[`phone > seed: 1211 > number() 1`] = `"1-587-319-0616 x27431"`; + +exports[`phone > seed: 1211 > phoneFormats() 1`] = `"1-!##-!##-#### x#####"`; + +exports[`phone > seed: 1211 > phoneNumber() 1`] = `"1-587-319-0616 x27431"`; + +exports[`phone > seed: 1211 > phoneNumberFormat > should return deterministic values for 1 1`] = `"(948) 821-9061"`; + +exports[`phone > seed: 1211 > phoneNumberFormat > should return deterministic values for 2 1`] = `"1-948-821-9061"`; + +exports[`phone > seed: 1211 > phoneNumberFormat > should return deterministic values for 3 1`] = `"948.821.9061"`; + +exports[`phone > seed: 1211 > phoneNumberFormat > should return deterministic values for 4 1`] = `"948-821-9061"`; + +exports[`phone > seed: 1211 > phoneNumberFormat() 1`] = `"948-821-9061"`; + +exports[`phone > seed: 1337 > imei() 1`] = `"25-122540-325523-4"`; + +exports[`phone > seed: 1337 > number() 1`] = `"(612) 454-0325"`; + +exports[`phone > seed: 1337 > phoneFormats() 1`] = `"(!##) !##-####"`; + +exports[`phone > seed: 1337 > phoneNumber() 1`] = `"(612) 454-0325"`; + +exports[`phone > seed: 1337 > phoneNumberFormat > should return deterministic values for 1 1`] = `"(451) 325-4032"`; + +exports[`phone > seed: 1337 > phoneNumberFormat > should return deterministic values for 2 1`] = `"1-451-325-4032"`; + +exports[`phone > seed: 1337 > phoneNumberFormat > should return deterministic values for 3 1`] = `"451.325.4032"`; + +exports[`phone > seed: 1337 > phoneNumberFormat > should return deterministic values for 4 1`] = `"451-325-4032"`; + +exports[`phone > seed: 1337 > phoneNumberFormat() 1`] = `"451-325-4032"`; diff --git a/test/__snapshots__/random.spec.ts.snap b/test/__snapshots__/random.spec.ts.snap new file mode 100644 index 00000000000..7102da68baa --- /dev/null +++ b/test/__snapshots__/random.spec.ts.snap @@ -0,0 +1,37 @@ +// Vitest Snapshot v1 + +exports[`random > seed: 42 > alpha() 1`] = `"j"`; + +exports[`random > seed: 42 > alphaNumeric() 1`] = `"d"`; + +exports[`random > seed: 42 > locale() 1`] = `"es_MX"`; + +exports[`random > seed: 42 > numeric() 1`] = `"4"`; + +exports[`random > seed: 42 > word() 1`] = `"extend"`; + +exports[`random > seed: 42 > words() 1`] = `"mobile Fish"`; + +exports[`random > seed: 1211 > alpha() 1`] = `"y"`; + +exports[`random > seed: 1211 > alphaNumeric() 1`] = `"x"`; + +exports[`random > seed: 1211 > locale() 1`] = `"ur"`; + +exports[`random > seed: 1211 > numeric() 1`] = `"9"`; + +exports[`random > seed: 1211 > word() 1`] = `"Division"`; + +exports[`random > seed: 1211 > words() 1`] = `"Turnpike Frozen Handcrafted"`; + +exports[`random > seed: 1337 > alpha() 1`] = `"g"`; + +exports[`random > seed: 1337 > alphaNumeric() 1`] = `"9"`; + +exports[`random > seed: 1337 > locale() 1`] = `"en_GH"`; + +exports[`random > seed: 1337 > numeric() 1`] = `"3"`; + +exports[`random > seed: 1337 > word() 1`] = `"leading"`; + +exports[`random > seed: 1337 > words() 1`] = `"Delaware"`; diff --git a/test/__snapshots__/science.spec.ts.snap b/test/__snapshots__/science.spec.ts.snap new file mode 100644 index 00000000000..bc7b0586044 --- /dev/null +++ b/test/__snapshots__/science.spec.ts.snap @@ -0,0 +1,46 @@ +// Vitest Snapshot v1 + +exports[`science > seed: 42 > chemicalElement() 1`] = ` +{ + "atomicNumber": 45, + "name": "Rhodium", + "symbol": "Rh", +} +`; + +exports[`science > seed: 42 > unit() 1`] = ` +{ + "name": "hertz", + "symbol": "Hz", +} +`; + +exports[`science > seed: 1211 > chemicalElement() 1`] = ` +{ + "atomicNumber": 110, + "name": "Darmstadtium", + "symbol": "Ds", +} +`; + +exports[`science > seed: 1211 > unit() 1`] = ` +{ + "name": "gray", + "symbol": "Gy", +} +`; + +exports[`science > seed: 1337 > chemicalElement() 1`] = ` +{ + "atomicNumber": 31, + "name": "Gallium", + "symbol": "Ga", +} +`; + +exports[`science > seed: 1337 > unit() 1`] = ` +{ + "name": "candela", + "symbol": "cd", +} +`; diff --git a/test/__snapshots__/system.spec.ts.snap b/test/__snapshots__/system.spec.ts.snap new file mode 100644 index 00000000000..3ed44caaa1a --- /dev/null +++ b/test/__snapshots__/system.spec.ts.snap @@ -0,0 +1,61 @@ +// Vitest Snapshot v1 + +exports[`system > seed: 42 > commonFileExt() 1`] = `"png"`; + +exports[`system > seed: 42 > commonFileName() 1`] = `"mobile_fish.mpe"`; + +exports[`system > seed: 42 > commonFileType() 1`] = `"audio"`; + +exports[`system > seed: 42 > directoryPath() 1`] = `"/opt/bin"`; + +exports[`system > seed: 42 > fileExt() 1`] = `"lrm"`; + +exports[`system > seed: 42 > fileName() 1`] = `"mobile_fish.jxsc"`; + +exports[`system > seed: 42 > filePath() 1`] = `"/opt/bin/directives_application_home.ptid"`; + +exports[`system > seed: 42 > fileType() 1`] = `"image"`; + +exports[`system > seed: 42 > mimeType() 1`] = `"application/vnd.ibm.rights-management"`; + +exports[`system > seed: 42 > semver() 1`] = `"3.7.9"`; + +exports[`system > seed: 1211 > commonFileExt() 1`] = `"htm"`; + +exports[`system > seed: 1211 > commonFileName() 1`] = `"turnpike_frozen_handcrafted.mp4v"`; + +exports[`system > seed: 1211 > commonFileType() 1`] = `"application"`; + +exports[`system > seed: 1211 > directoryPath() 1`] = `"/var/log"`; + +exports[`system > seed: 1211 > fileExt() 1`] = `"dic"`; + +exports[`system > seed: 1211 > fileName() 1`] = `"turnpike_frozen_handcrafted.heifs"`; + +exports[`system > seed: 1211 > filePath() 1`] = `"/var/log/forward_supervisor.z2"`; + +exports[`system > seed: 1211 > fileType() 1`] = `"x-shader"`; + +exports[`system > seed: 1211 > mimeType() 1`] = `"text/vnd.dmclientscript"`; + +exports[`system > seed: 1211 > semver() 1`] = `"9.4.8"`; + +exports[`system > seed: 1337 > commonFileExt() 1`] = `"wav"`; + +exports[`system > seed: 1337 > commonFileName() 1`] = `"delaware.mp2"`; + +exports[`system > seed: 1337 > commonFileType() 1`] = `"audio"`; + +exports[`system > seed: 1337 > directoryPath() 1`] = `"/Library"`; + +exports[`system > seed: 1337 > fileExt() 1`] = `"oa3"`; + +exports[`system > seed: 1337 > fileName() 1`] = `"delaware.cmc"`; + +exports[`system > seed: 1337 > filePath() 1`] = `"/Library/bike_interactive.link66"`; + +exports[`system > seed: 1337 > fileType() 1`] = `"font"`; + +exports[`system > seed: 1337 > mimeType() 1`] = `"application/vnd.chipnuts.karaoke-mmd"`; + +exports[`system > seed: 1337 > semver() 1`] = `"2.5.1"`; diff --git a/test/__snapshots__/unique.spec.ts.snap b/test/__snapshots__/unique.spec.ts.snap new file mode 100644 index 00000000000..d6ce5e55060 --- /dev/null +++ b/test/__snapshots__/unique.spec.ts.snap @@ -0,0 +1,25 @@ +// Vitest Snapshot v1 + +exports[`unique > seed: 42 > unique(() => number) 1`] = `37454`; + +exports[`unique > seed: 42 > unique(() => number), args) 1`] = `19`; + +exports[`unique > seed: 42 > unique(customMethod) 1`] = `"Test-188"`; + +exports[`unique > seed: 42 > unique(customMethod, args) 1`] = `"prefix-1-Test-188"`; + +exports[`unique > seed: 1211 > unique(() => number) 1`] = `92852`; + +exports[`unique > seed: 1211 > unique(() => number), args) 1`] = `47`; + +exports[`unique > seed: 1211 > unique(customMethod) 1`] = `"Test-465"`; + +exports[`unique > seed: 1211 > unique(customMethod, args) 1`] = `"prefix-1-Test-465"`; + +exports[`unique > seed: 1337 > unique(() => number) 1`] = `26202`; + +exports[`unique > seed: 1337 > unique(() => number), args) 1`] = `13`; + +exports[`unique > seed: 1337 > unique(customMethod) 1`] = `"Test-132"`; + +exports[`unique > seed: 1337 > unique(customMethod, args) 1`] = `"prefix-1-Test-132"`; diff --git a/test/__snapshots__/vehicle.spec.ts.snap b/test/__snapshots__/vehicle.spec.ts.snap new file mode 100644 index 00000000000..eaf9a4a083d --- /dev/null +++ b/test/__snapshots__/vehicle.spec.ts.snap @@ -0,0 +1,55 @@ +// Vitest Snapshot v1 + +exports[`vehicle > seed: 42 > bicycle() 1`] = `"Fitness Bicycle"`; + +exports[`vehicle > seed: 42 > color() 1`] = `"grey"`; + +exports[`vehicle > seed: 42 > fuel() 1`] = `"Electric"`; + +exports[`vehicle > seed: 42 > manufacturer() 1`] = `"Ford"`; + +exports[`vehicle > seed: 42 > model() 1`] = `"Escalade"`; + +exports[`vehicle > seed: 42 > type() 1`] = `"Extended Cab Pickup"`; + +exports[`vehicle > seed: 42 > vehicle() 1`] = `"Ford Golf"`; + +exports[`vehicle > seed: 42 > vin() 1`] = `"CTY6RSKK5ED315227"`; + +exports[`vehicle > seed: 42 > vrm() 1`] = `"JU91TUP"`; + +exports[`vehicle > seed: 1211 > bicycle() 1`] = `"Triathlon/Time Trial Bicycle"`; + +exports[`vehicle > seed: 1211 > color() 1`] = `"azure"`; + +exports[`vehicle > seed: 1211 > fuel() 1`] = `"Hybrid"`; + +exports[`vehicle > seed: 1211 > manufacturer() 1`] = `"Toyota"`; + +exports[`vehicle > seed: 1211 > model() 1`] = `"2"`; + +exports[`vehicle > seed: 1211 > type() 1`] = `"Wagon"`; + +exports[`vehicle > seed: 1211 > vehicle() 1`] = `"Toyota Challenger"`; + +exports[`vehicle > seed: 1211 > vin() 1`] = `"XFWS74Z1N5S678767"`; + +exports[`vehicle > seed: 1211 > vrm() 1`] = `"YL87FDZ"`; + +exports[`vehicle > seed: 1337 > bicycle() 1`] = `"Cyclocross Bicycle"`; + +exports[`vehicle > seed: 1337 > color() 1`] = `"black"`; + +exports[`vehicle > seed: 1337 > fuel() 1`] = `"Electric"`; + +exports[`vehicle > seed: 1337 > manufacturer() 1`] = `"Dodge"`; + +exports[`vehicle > seed: 1337 > model() 1`] = `"Colorado"`; + +exports[`vehicle > seed: 1337 > type() 1`] = `"Coupe"`; + +exports[`vehicle > seed: 1337 > vehicle() 1`] = `"Dodge Model S"`; + +exports[`vehicle > seed: 1337 > vin() 1`] = `"8J579HF1A7MK33574"`; + +exports[`vehicle > seed: 1337 > vrm() 1`] = `"GO12HOL"`; diff --git a/test/__snapshots__/word.spec.ts.snap b/test/__snapshots__/word.spec.ts.snap new file mode 100644 index 00000000000..0b200ad5d14 --- /dev/null +++ b/test/__snapshots__/word.spec.ts.snap @@ -0,0 +1,127 @@ +// Vitest Snapshot v1 + +exports[`word > seed: 42 > adjective() 1`] = `"harmonious"`; + +exports[`word > seed: 42 > adjective(10) 1`] = `"gregarious"`; + +exports[`word > seed: 42 > adjective(20) 1`] = `"harmonious"`; + +exports[`word > seed: 42 > adverb() 1`] = `"jealously"`; + +exports[`word > seed: 42 > adverb(10) 1`] = `"generously"`; + +exports[`word > seed: 42 > adverb(20) 1`] = `"jealously"`; + +exports[`word > seed: 42 > conjunction() 1`] = `"however"`; + +exports[`word > seed: 42 > conjunction(10) 1`] = `"as much as"`; + +exports[`word > seed: 42 > conjunction(20) 1`] = `"however"`; + +exports[`word > seed: 42 > interjection() 1`] = `"yahoo"`; + +exports[`word > seed: 42 > interjection(10) 1`] = `"yahoo"`; + +exports[`word > seed: 42 > interjection(20) 1`] = `"yahoo"`; + +exports[`word > seed: 42 > noun() 1`] = `"gale"`; + +exports[`word > seed: 42 > noun(10) 1`] = `"exposition"`; + +exports[`word > seed: 42 > noun(20) 1`] = `"gale"`; + +exports[`word > seed: 42 > preposition() 1`] = `"concerning"`; + +exports[`word > seed: 42 > preposition(10) 1`] = `"throughout"`; + +exports[`word > seed: 42 > preposition(20) 1`] = `"concerning"`; + +exports[`word > seed: 42 > verb() 1`] = `"function"`; + +exports[`word > seed: 42 > verb(10) 1`] = `"exasperate"`; + +exports[`word > seed: 42 > verb(20) 1`] = `"function"`; + +exports[`word > seed: 1211 > adjective() 1`] = `"verifiable"`; + +exports[`word > seed: 1211 > adjective(10) 1`] = `"unfinished"`; + +exports[`word > seed: 1211 > adjective(20) 1`] = `"verifiable"`; + +exports[`word > seed: 1211 > adverb() 1`] = `"viciously"`; + +exports[`word > seed: 1211 > adverb(10) 1`] = `"unbearably"`; + +exports[`word > seed: 1211 > adverb(20) 1`] = `"viciously"`; + +exports[`word > seed: 1211 > conjunction() 1`] = `"whereas"`; + +exports[`word > seed: 1211 > conjunction(10) 1`] = `"as soon as"`; + +exports[`word > seed: 1211 > conjunction(20) 1`] = `"whereas"`; + +exports[`word > seed: 1211 > interjection() 1`] = `"er"`; + +exports[`word > seed: 1211 > interjection(10) 1`] = `"er"`; + +exports[`word > seed: 1211 > interjection(20) 1`] = `"er"`; + +exports[`word > seed: 1211 > noun() 1`] = `"trick"`; + +exports[`word > seed: 1211 > noun(10) 1`] = `"trafficker"`; + +exports[`word > seed: 1211 > noun(20) 1`] = `"trick"`; + +exports[`word > seed: 1211 > preposition() 1`] = `"upon"`; + +exports[`word > seed: 1211 > preposition(10) 1`] = `"underneath"`; + +exports[`word > seed: 1211 > preposition(20) 1`] = `"upon"`; + +exports[`word > seed: 1211 > verb() 1`] = `"trick"`; + +exports[`word > seed: 1211 > verb(10) 1`] = `"trampoline"`; + +exports[`word > seed: 1211 > verb(20) 1`] = `"trick"`; + +exports[`word > seed: 1337 > adjective() 1`] = `"fabulous"`; + +exports[`word > seed: 1337 > adjective(10) 1`] = `"enchanting"`; + +exports[`word > seed: 1337 > adjective(20) 1`] = `"fabulous"`; + +exports[`word > seed: 1337 > adverb() 1`] = `"frankly"`; + +exports[`word > seed: 1337 > adverb(10) 1`] = `"enormously"`; + +exports[`word > seed: 1337 > adverb(20) 1`] = `"frankly"`; + +exports[`word > seed: 1337 > conjunction() 1`] = `"even if"`; + +exports[`word > seed: 1337 > conjunction(10) 1`] = `"as long as"`; + +exports[`word > seed: 1337 > conjunction(20) 1`] = `"even if"`; + +exports[`word > seed: 1337 > interjection() 1`] = `"ew"`; + +exports[`word > seed: 1337 > interjection(10) 1`] = `"ew"`; + +exports[`word > seed: 1337 > interjection(20) 1`] = `"ew"`; + +exports[`word > seed: 1337 > noun() 1`] = `"digit"`; + +exports[`word > seed: 1337 > noun(10) 1`] = `"depressive"`; + +exports[`word > seed: 1337 > noun(20) 1`] = `"digit"`; + +exports[`word > seed: 1337 > preposition() 1`] = `"barring"`; + +exports[`word > seed: 1337 > preposition(10) 1`] = `"concerning"`; + +exports[`word > seed: 1337 > preposition(20) 1`] = `"barring"`; + +exports[`word > seed: 1337 > verb() 1`] = `"dispense"`; + +exports[`word > seed: 1337 > verb(10) 1`] = `"demoralize"`; + +exports[`word > seed: 1337 > verb(20) 1`] = `"dispense"`; diff --git a/test/address.spec.ts b/test/address.spec.ts index 749a2f9fa46..76206b93f4d 100644 --- a/test/address.spec.ts +++ b/test/address.spec.ts @@ -1,5 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; +import { seededRuns } from './support/seededRuns'; import { times } from './support/times'; function degreesToRadians(degrees: number) { @@ -34,99 +35,6 @@ function haversine( return isMetric ? distance : kilometersToMiles(distance); } -const seededRuns = [ - { - seed: 42, - expectations: { - city: 'Port Valentine', - cityPrefix: 'West', - citySuffix: 'bury', - cityName: 'Gulfport', - streetName: 'Peyton Village', - streetPrefix: 'b', - streetSuffix: 'Isle', - streetAddress: '7917 Metz Pine', - fullStreetAddress: '7917 Metz Pine Apt. 410', - secondaryAddress: 'Apt. 791', - county: 'Berkshire', - country: 'Haiti', - countryCode: 'GY', - state: 'Maine', - stateAbbr: 'ME', - zipCode: '79177', - direction: 'South', - directionNonAbbr: 'South', - directionAbbr: 'S', - ordinalDirection: 'Northwest', - ordinalDirectionAbbr: 'NW', - cardinalDirection: 'East', - cardinalDirectionAbbr: 'E', - timeZone: 'Europe/Amsterdam', - nearbyGpsCoordinates: ['0.0814', '-0.0809'], - }, - }, - { - seed: 1337, - expectations: { - city: 'New Carmelo', - cityPrefix: 'West', - citySuffix: 'boro', - cityName: 'Dubuque', - streetName: 'Keith Dam', - streetPrefix: 'a', - streetSuffix: 'Forks', - streetAddress: '51225 Alexys Haven', - fullStreetAddress: '51225 Alexys Haven Apt. 552', - secondaryAddress: 'Apt. 512', - county: 'Bedfordshire', - country: 'Equatorial Guinea', - countryCode: 'EH', - state: 'Indiana', - stateAbbr: 'IN', - zipCode: '51225', - direction: 'South', - directionNonAbbr: 'South', - directionAbbr: 'S', - ordinalDirection: 'Northwest', - ordinalDirectionAbbr: 'NW', - cardinalDirection: 'East', - cardinalDirectionAbbr: 'E', - timeZone: 'Africa/Casablanca', - nearbyGpsCoordinates: ['0.0806', '-0.0061'], - }, - }, - { - seed: 1211, - expectations: { - city: 'La Crosse', - cityPrefix: 'Fort', - citySuffix: 'shire', - cityName: 'Urbana', - streetName: 'Koch Turnpike', - streetPrefix: 'c', - streetSuffix: 'Via', - streetAddress: '487 Breana Wells', - fullStreetAddress: '487 Breana Wells Apt. 616', - secondaryAddress: 'Suite 487', - county: 'Cambridgeshire', - country: 'Uganda', - countryCode: 'UM', - state: 'Washington', - stateAbbr: 'WA', - zipCode: '48721-9061', - direction: 'Southwest', - directionNonAbbr: 'Southwest', - directionAbbr: 'SW', - ordinalDirection: 'Southwest', - ordinalDirectionAbbr: 'SW', - cardinalDirection: 'West', - cardinalDirectionAbbr: 'W', - timeZone: 'Asia/Magadan', - nearbyGpsCoordinates: ['-0.0287', '0.0596'], - }, - }, -]; - const NON_SEEDED_BASED_RUN = 5; const functionNames = [ @@ -152,14 +60,14 @@ describe('address', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.address[functionName](); - expect(actual).toBe(expectations[functionName]); + expect(actual).toMatchSnapshot(); }); } @@ -169,14 +77,15 @@ describe('address', () => { const address = faker.address.streetAddress(); - expect(address).toStrictEqual(expectations.streetAddress); + expect(address).toMatchSnapshot(); }); it('should return street name with a building number and a secondary address', () => { faker.seed(seed); const address = faker.address.streetAddress(true); - expect(address).toEqual(expectations.fullStreetAddress); + + expect(address).toMatchSnapshot(); }); }); @@ -185,36 +94,24 @@ describe('address', () => { faker.seed(seed); const direction = faker.address.direction(); - const expected = expectations.direction; - expect( - direction, - `The random direction should be equal to ${expected}` - ).toBe(expected); + expect(direction).toMatchSnapshot(); }); it('should not return abbreviation when useAbbr is false', () => { faker.seed(seed); const direction = faker.address.direction(false); - const expected = expectations.directionNonAbbr; - expect( - direction, - `The abbreviation of direction when useAbbr is false should be equal ${expected}. Current is ${direction}` - ).toBe(expected); + expect(direction).toMatchSnapshot(); }); it('returns abbreviation when useAbbr is true', () => { faker.seed(seed); const direction = faker.address.direction(true); - const expected = expectations.directionAbbr; - expect( - direction, - `The abbreviation of direction when useAbbr is true should be equal ${expected}. Current is ${direction}` - ).toBe(expected); + expect(direction).toMatchSnapshot(); }); }); @@ -223,24 +120,16 @@ describe('address', () => { faker.seed(seed); const ordinalDirection = faker.address.ordinalDirection(); - const expected = expectations.ordinalDirection; - expect( - ordinalDirection, - `The ransom ordinal direction should be equal ${expected}. Current is ${ordinalDirection}` - ).toBe(expected); + expect(ordinalDirection).toMatchSnapshot(); }); it('returns abbreviation when useAbbr is true', () => { faker.seed(seed); const ordinalDirection = faker.address.ordinalDirection(true); - const expected = expectations.ordinalDirectionAbbr; - expect( - ordinalDirection, - `The ordinal direction when useAbbr is true should be equal ${expected}. Current is ${ordinalDirection}` - ).toBe(expected); + expect(ordinalDirection).toMatchSnapshot(); }); }); @@ -249,24 +138,16 @@ describe('address', () => { faker.seed(seed); const cardinalDirection = faker.address.cardinalDirection(); - const expected = expectations.cardinalDirection; - expect( - cardinalDirection, - `The random cardinal direction should be equal ${expected}. Current is ${cardinalDirection}` - ).toBe(expected); + expect(cardinalDirection).toMatchSnapshot(); }); it('returns abbreviation when useAbbr is true', () => { faker.seed(seed); const cardinalDirection = faker.address.cardinalDirection(true); - const expected = expectations.cardinalDirectionAbbr; - expect( - cardinalDirection, - `The cardinal direction when useAbbr is true should be equal ${expected}. Current is ${cardinalDirection}` - ).toBe(expected); + expect(cardinalDirection).toMatchSnapshot(); }); }); @@ -277,7 +158,8 @@ describe('address', () => { // this input is required for all expected results for this function const coordsInput: [number, number] = [0, 0]; const coords = faker.address.nearbyGPSCoordinate(coordsInput); - expect(coords).toEqual(expectations.nearbyGpsCoordinates); + + expect(coords).toMatchSnapshot(); }); }); }); diff --git a/test/animal.spec.ts b/test/animal.spec.ts index a3ad1af6d42..4f3d2370ddb 100644 --- a/test/animal.spec.ts +++ b/test/animal.spec.ts @@ -1,65 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - bear: 'Sun bear', - bird: 'Iceland Gull', - cat: 'Himalayan', - cetacean: 'Pantropical Spotted Dolphin', - cow: 'Fleckvieh', - crocodilia: 'African Slender-snouted Crocodile', - dog: 'Garafian Shepherd', - fish: 'Northern snakehead', - horse: 'Furioso-North Star', - insect: 'Gouty oak gall', - lion: 'West African Lion', - rabbit: 'English Spot', - snake: 'Grey-banded kingsnake', - type: 'lion', - }, - }, - { - seed: 1337, - expectations: { - bear: 'Sun bear', - bird: 'American Golden-Plover', - cat: 'Devon Rex', - cetacean: 'Costero', - cow: 'Canchim', - crocodilia: 'Cuvierโ€™s Dwarf Caiman', - dog: 'Chinese Crested Dog', - fish: 'Jumbo flying squid', - horse: 'Colorado Ranger', - insect: 'Eulophid wasp', - lion: 'Barbary Lion', - rabbit: 'Cinnamon', - snake: 'Fierce snake', - type: 'bear', - }, - }, - { - seed: 1211, - expectations: { - bear: 'Polar bear', - bird: 'Reed Bunting', - cat: 'Tonkinese', - cetacean: 'La Plata Dolphin', - cow: 'Breed', - crocodilia: 'Gharial', - dog: 'Tibetan Spaniel', - fish: 'Bigeye scad', - horse: 'Ukrainian Riding Horse', - insect: 'Western paper wasp', - lion: 'Cape lion', - rabbit: 'Silver Marten', - snake: 'Tiger pit viper', - type: 'horse', - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -85,14 +26,15 @@ describe('animal', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.animal[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/color.spec.ts b/test/color.spec.ts index 9d438291783..a1b5dd9d905 100644 --- a/test/color.spec.ts +++ b/test/color.spec.ts @@ -1,57 +1,7 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; import { CSS_FUNCTIONS, CSS_SPACES } from '../src/modules/color'; - -const seededRuns = [ - { - seed: 42, - expectations: { - human: 'grey', - space: 'Rec. 709', - cssSupportedFunction: 'hsla', - cssSupportedSpace: 'rec2020', - rgb: '#8be4ab', - hsl: [135, 0.8, 0.96], - hwb: [135, 0.8, 0.96], - cmyk: [0.37, 0.8, 0.96, 0.18], - lab: [0.37454, 59.3086, 90.1429], - lch: [0.37454, 183.2, 218.7], - colorByCSSColorSpace: [0.3745, 0.7966, 0.9508], - }, - }, - { - seed: 1337, - expectations: { - human: 'black', - space: 'ProPhoto RGB Color Space', - cssSupportedFunction: 'hsl', - cssSupportedSpace: 'display-p3', - rgb: '#5c346b', - hsl: [94, 0.56, 0.16], - hwb: [94, 0.56, 0.16], - cmyk: [0.26, 0.56, 0.16, 0.21], - lab: [0.262024, 12.106, -68.2632], - lch: [0.262024, 128.9, 36.5], - colorByCSSColorSpace: [0.262, 0.5605, 0.1586], - }, - }, - { - seed: 1211, - expectations: { - human: 'azure', - space: 'LMS', - cssSupportedFunction: 'color', - cssSupportedSpace: 'rec2020', - rgb: '#eadb42', - hsl: [335, 0.46, 0.9], - hwb: [335, 0.46, 0.9], - cmyk: [0.93, 0.46, 0.9, 0.78], - lab: [0.928521, -8.197, 78.6944], - lch: [0.928521, 105.6, 205.5], - colorByCSSColorSpace: [0.9286, 0.459, 0.8935], - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -74,14 +24,15 @@ describe('color', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.color[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/commerce.spec.ts b/test/commerce.spec.ts index 383b0a41c31..bbd33ff0152 100644 --- a/test/commerce.spec.ts +++ b/test/commerce.spec.ts @@ -1,50 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - color: 'grey', - department: 'Tools', - productName: 'Fantastic Soft Sausages', - price: '375.00', - productAdjective: 'Fantastic', - productMaterial: 'Plastic', - product: 'Pants', - productDescription: - 'The Apollotech B340 is an affordable wireless mouse with reliable connectivity, 12 months battery life and modern design', - }, - }, - { - seed: 1337, - expectations: { - color: 'black', - department: 'Computers', - productName: 'Incredible Granite Keyboard', - price: '263.00', - productAdjective: 'Incredible', - productMaterial: 'Concrete', - product: 'Ball', - productDescription: - 'The slim & simple Maple Gaming Keyboard from Dev Byte comes with a sleek body and 7- Color RGB LED Back-lighting for smart functionality', - }, - }, - { - seed: 1211, - expectations: { - color: 'azure', - department: 'Automotive', - productName: 'Unbranded Cotton Salad', - price: '929.00', - productAdjective: 'Unbranded', - productMaterial: 'Frozen', - product: 'Sausages', - productDescription: - 'Andy shoes are designed to keeping in mind durability as well as trends, the most stylish range of shoes & sandals', - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -64,14 +20,15 @@ describe('commerce', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.commerce[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/company.spec.ts b/test/company.spec.ts index 6ef8b551aab..b0f207923ee 100644 --- a/test/company.spec.ts +++ b/test/company.spec.ts @@ -1,56 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - suffixes: ['Inc', 'and Sons', 'LLC', 'Group'], - companyName: 'Schinner - Wiegand', - companySuffix: 'and Sons', - catchPhrase: 'Implemented responsive throughput', - bs: 'seize impactful web services', - catchPhraseAdjective: 'Implemented', - catchPhraseDescriptor: 'explicit', - catchPhraseNoun: 'framework', - bsAdjective: 'dynamic', - bsBuzz: 'seize', - bsNoun: 'portals', - }, - }, - { - seed: 1337, - expectations: { - suffixes: ['Inc', 'and Sons', 'LLC', 'Group'], - companyName: 'Macejkovic Inc', - companySuffix: 'and Sons', - catchPhrase: 'Expanded leading edge capacity', - bs: 'incentivize efficient initiatives', - catchPhraseAdjective: 'Expanded', - catchPhraseDescriptor: 'demand-driven', - catchPhraseNoun: 'data-warehouse', - bsAdjective: 'global', - bsBuzz: 'incentivize', - bsNoun: 'ROI', - }, - }, - { - seed: 1211, - expectations: { - suffixes: ['Inc', 'and Sons', 'LLC', 'Group'], - companyName: 'Koch, Trantow and Sanford', - companySuffix: 'Group', - catchPhrase: 'Up-sized high-level success', - bs: 'cultivate bleeding-edge functionalities', - catchPhraseAdjective: 'Up-sized', - catchPhraseDescriptor: 'upward-trending', - catchPhraseNoun: 'system engine', - bsAdjective: 'plug-and-play', - bsBuzz: 'cultivate', - bsNoun: 'experiences', - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -73,14 +23,15 @@ describe('company', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.company[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/database.spec.ts b/test/database.spec.ts index 75fe6ac36ba..d9f538caab2 100644 --- a/test/database.spec.ts +++ b/test/database.spec.ts @@ -1,38 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - column: 'token', - type: 'smallint', - collation: 'utf8_bin', - engine: 'MEMORY', - mongodbObjectId: '8be4abdd39321ad7d3fe01ff', - }, - }, - { - seed: 1337, - expectations: { - column: 'email', - type: 'time', - collation: 'utf8_general_ci', - engine: 'MyISAM', - mongodbObjectId: '5c346ba075bd57f5a62b82d7', - }, - }, - { - seed: 1211, - expectations: { - column: 'createdAt', - type: 'geometry', - collation: 'cp1250_general_ci', - engine: 'ARCHIVE', - mongodbObjectId: 'eadb42f0e3f4a973fab0aeef', - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -49,14 +17,15 @@ describe('database', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.database[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/datatype.spec.ts b/test/datatype.spec.ts index 9b6a74b3711..04da02d2826 100644 --- a/test/datatype.spec.ts +++ b/test/datatype.spec.ts @@ -1,224 +1,6 @@ import { describe, expect, it } from 'vitest'; import { faker, FakerError } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - number: { - noArgs: 37454, - numbers: [2, 5, 6, 1, 5], - withMin: 37412, - withMinAndMax: -1, - withMax: 26, - withMinAndMaxAndPrecision: -0.43, - }, - float: { - noArgs: 37453.64, - numbers: [37452, 79656, 95076, 18342, 73200], - withMin: 37411.64, - withMinAndMax: -0.43, - withMax: 25.84, - withMinAndMaxAndPrecision: -0.4261, - }, - datetime: { - noArgs: new Date('2031-03-14T21:33:22.114Z'), - number: new Date('1994-03-20T17:23:00.629Z'), - withMin: new Date('1801-04-11T15:13:06.330Z'), - withMax: new Date('1994-07-11T09:43:47.230Z'), - withMinMax: new Date('1689-09-09T08:39:09.444Z'), - }, - string: { - noArgs: 'Cky2eiXX/J', - length: 'Cky2eiXX/J/*&Kq@X.b]"&{dnx4!1}2Z=YQ!I#6', - length: '9U/4:SK$>6QX9@{:e=+kD)[B,e|/Jqjjj!BLGDWQgC', - }, - uuid: { - noArgs: '48234870-5389-445f-8b41-c61a52bf27dc', - }, - boolean: { - noArgs: false, - }, - hexadecimal: { - noArgs: '0x5', - length: '0x5c346ba075bd57F5A62B82d72AF39CBBB07a98cbA8', - }, - json: { - noArgs: JSON.stringify({ - foo: 56052, - bar: 21258, - bike: 54308, - a: 3397, - b: 23538, - name: 'X9@{:e=+kD', - prop: 62850, - }), - }, - array: { - noArgs: [ - 56052, - 21258, - 54308, - 3397, - 23538, - 'X9@{:e=+kD', - 62850, - 12505, - '|/Jqjjj!BL', - 38106, - ], - length: [56052, 21258, 54308, 3397], - }, - bigInt: { - noArgs: 251225403255239n, - value: 25n, - }, - }, - }, - { - seed: 1211, - expectations: { - number: { - noArgs: 92852, - numbers: [6, 3, 6, 5, 1], - withMin: 92810, - withMinAndMax: 61, - withMax: 64, - withMinAndMaxAndPrecision: 61.07, - }, - float: { - noArgs: 92851.09, - numbers: [92856, 45900, 89346, 77826, 22554], - withMin: 92809.09, - withMinAndMax: 61.07, - withMax: 64.07, - withMinAndMaxAndPrecision: 61.0658, - }, - datetime: { - noArgs: new Date('2092-02-20T03:42:04.341Z'), - number: new Date('2000-06-14T02:54:42.082Z'), - withMin: new Date('2065-11-10T19:27:20.915Z'), - withMax: new Date('2001-03-20T11:14:25.251Z'), - withMinMax: new Date('1789-03-26T15:44:45.219Z'), - }, - string: { - noArgs: 'wKti5-}$_/', - length: 'wKti5-}$_/`4hHA0afl"h^]dnwI { - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.datatype[functionName](); - expect(actual).toEqual(expectations[functionName].noArgs); + expect(actual).toMatchSnapshot(); }); } @@ -251,9 +33,9 @@ describe('datatype', () => { it('should return a deterministic value for given number', () => { faker.seed(seed); - for (const num of expectations.number.numbers) { + for (let i = 0; i < 5; i++) { const actual = faker.datatype.number(6); - expect(actual).toEqual(num); + expect(actual).toMatchSnapshot(); } }); @@ -261,21 +43,21 @@ describe('datatype', () => { faker.seed(seed); const actual = faker.datatype.number({ min: -42 }); - expect(actual).toEqual(expectations.number.withMin); + expect(actual).toMatchSnapshot(); }); it('should return a deterministic value for given min and max', () => { faker.seed(seed); const actual = faker.datatype.number({ min: -42, max: 69 }); - expect(actual).toEqual(expectations.number.withMinAndMax); + expect(actual).toMatchSnapshot(); }); it('should return a deterministic value for given max', () => { faker.seed(seed); const actual = faker.datatype.number({ max: 69 }); - expect(actual).toEqual(expectations.number.withMax); + expect(actual).toMatchSnapshot(); }); it('should return a deterministic value for given min, max and precision', () => { @@ -286,7 +68,7 @@ describe('datatype', () => { max: 69, precision: 0.01, }); - expect(actual).toEqual(expectations.number.withMinAndMaxAndPrecision); + expect(actual).toMatchSnapshot(); }); it('should throw when min > max', () => { @@ -305,9 +87,9 @@ describe('datatype', () => { it('should return a deterministic value for given number', () => { faker.seed(seed); - for (const num of expectations.float.numbers) { + for (let i = 0; i < 5; i++) { const actual = faker.datatype.float(6); - expect(actual).toEqual(num); + expect(actual).toMatchSnapshot(); } }); @@ -315,21 +97,21 @@ describe('datatype', () => { faker.seed(seed); const actual = faker.datatype.float({ min: -42 }); - expect(actual).toEqual(expectations.float.withMin); + expect(actual).toMatchSnapshot(); }); it('should return a deterministic value for given min and max', () => { faker.seed(seed); const actual = faker.datatype.float({ min: -42, max: 69 }); - expect(actual).toEqual(expectations.float.withMinAndMax); + expect(actual).toMatchSnapshot(); }); it('should return a deterministic value for given max', () => { faker.seed(seed); const actual = faker.datatype.float({ max: 69 }); - expect(actual).toEqual(expectations.float.withMax); + expect(actual).toMatchSnapshot(); }); it('should return a deterministic value for given min, max and precision', () => { @@ -340,7 +122,7 @@ describe('datatype', () => { max: 69, precision: 0.0001, }); - expect(actual).toEqual(expectations.float.withMinAndMaxAndPrecision); + expect(actual).toMatchSnapshot(); }); }); @@ -351,7 +133,7 @@ describe('datatype', () => { const actual = faker.datatype.datetime( Date.parse('2001-04-03T23:21:10.773Z') ); - expect(actual).toEqual(expectations.datetime.number); + expect(actual).toMatchSnapshot(); }); it('should return a deterministic date when given a min date', () => { @@ -360,7 +142,7 @@ describe('datatype', () => { const actual = faker.datatype.datetime({ min: Date.parse('1622-05-23T13:45:08.843Z'), }); - expect(actual).toEqual(expectations.datetime.withMin); + expect(actual).toMatchSnapshot(); }); it('should return a deterministic date when given a max date', () => { @@ -369,7 +151,7 @@ describe('datatype', () => { const actual = faker.datatype.datetime({ max: Date.parse('2002-01-29T19:47:52.605Z'), }); - expect(actual).toEqual(expectations.datetime.withMax); + expect(actual).toMatchSnapshot(); }); it('should return a deterministic date when given a min and max date', () => { @@ -379,7 +161,7 @@ describe('datatype', () => { min: Date.parse('1622-05-23T13:45:08.843Z'), max: Date.parse('1802-01-29T19:47:52.605Z'), }); - expect(actual).toEqual(expectations.datetime.withMinMax); + expect(actual).toMatchSnapshot(); }); }); @@ -388,7 +170,7 @@ describe('datatype', () => { faker.seed(seed); const actual = faker.datatype.string(42); - expect(actual).toEqual(expectations.string.length); + expect(actual).toMatchSnapshot(); }); }); @@ -397,7 +179,7 @@ describe('datatype', () => { faker.seed(seed); const actual = faker.datatype.hexadecimal(42); - expect(actual).toEqual(expectations.hexadecimal.length); + expect(actual).toMatchSnapshot(); }); }); @@ -406,7 +188,7 @@ describe('datatype', () => { faker.seed(seed); const actual = faker.datatype.array(4); - expect(actual).toEqual(expectations.array.length); + expect(actual).toMatchSnapshot(); }); }); @@ -415,7 +197,7 @@ describe('datatype', () => { faker.seed(seed); const actual = faker.datatype.bigInt(42); - expect(actual).toEqual(expectations.bigInt.value); + expect(actual).toMatchSnapshot(); }); it('should throw when min > max', () => { diff --git a/test/date.spec.ts b/test/date.spec.ts index 228c7a06365..f6f64dbe839 100644 --- a/test/date.spec.ts +++ b/test/date.spec.ts @@ -1,134 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - past: { - noArgs: new Date('2020-10-08T00:10:58.041Z'), - ten: new Date('2017-05-26T15:26:24.637Z'), - }, - future: { - noArgs: new Date('2021-07-08T10:07:33.381Z'), - ten: new Date('2024-11-19T18:52:06.785Z'), - }, - between: new Date('2021-03-15T19:30:57.091Z'), - betweens: [ - new Date('2021-03-15T19:30:57.091Z'), - new Date('2021-04-09T17:05:10.406Z'), - new Date('2021-04-18T19:23:52.973Z'), - ], - recent: new Date('2021-02-21T08:11:56.820Z'), - soon: new Date('2021-03-13T23:15:38.042Z'), - month: { - noArgs: 'May', - abbr: 'May', - context: 'May', - abbr_context: 'May', - }, - weekday: { - noArgs: 'Tuesday', - abbr: 'Tue', - context: 'Tuesday', - abbr_context: 'Tue', - }, - birthdate: { - noArgs: new Date('1943-08-06T10:03:17.283Z'), - ageMode: new Date('1942-09-15T09:55:20.478Z'), - ageRange: new Date('1941-12-15T14:59:26.122Z'), - age: new Date('1959-06-26T13:52:19.442Z'), - yearMode: new Date('1943-08-06T10:03:17.283Z'), - yearRange: new Date('1937-10-30T15:52:07.381Z'), - year: new Date('2000-05-16T22:59:36.513Z'), - }, - }, - }, - { - seed: 1337, - expectations: { - past: { - noArgs: new Date('2020-11-18T01:49:04.785Z'), - ten: new Date('2018-07-11T07:47:33.089Z'), - }, - future: { - noArgs: new Date('2021-05-28T08:29:26.637Z'), - ten: new Date('2023-10-06T02:30:58.333Z'), - }, - between: new Date('2021-03-09T04:11:24.667Z'), - betweens: [ - new Date('2021-03-03T01:51:22.512Z'), - new Date('2021-03-09T04:11:24.667Z'), - new Date('2021-03-26T18:53:00.564Z'), - ], - recent: new Date('2021-02-21T10:53:58.041Z'), - soon: new Date('2021-03-13T20:33:36.821Z'), - month: { - noArgs: 'April', - abbr: 'Apr', - context: 'April', - abbr_context: 'Apr', - }, - weekday: { - noArgs: 'Monday', - abbr: 'Mon', - context: 'Monday', - abbr_context: 'Mon', - }, - birthdate: { - noArgs: new Date('1936-07-04T15:55:47.989Z'), - ageMode: new Date('1935-08-14T07:41:47.183Z'), - ageRange: new Date('1935-02-03T18:44:07.874Z'), - age: new Date('1959-05-16T12:14:12.585Z'), - yearMode: new Date('1936-07-04T15:55:47.989Z'), - yearRange: new Date('1926-06-20T07:18:05.539Z'), - year: new Date('2000-04-06T02:45:32.324Z'), - }, - }, - }, - { - seed: 1211, - expectations: { - past: { - noArgs: new Date('2020-03-19T19:19:04.071Z'), - ten: new Date('2011-11-12T14:47:19.955Z'), - }, - future: { - noArgs: new Date('2022-01-26T14:59:27.351Z'), - ten: new Date('2030-06-03T19:31:11.467Z'), - }, - between: new Date('2021-04-17T11:58:13.327Z'), - betweens: [ - new Date('2021-03-20T19:08:07.621Z'), // done - new Date('2021-04-15T10:20:25.794Z'), - new Date('2021-04-17T11:58:13.327Z'), - ], - recent: new Date('2021-02-20T18:54:13.498Z'), - soon: new Date('2021-03-14T12:33:21.364Z'), - month: { - noArgs: 'December', - abbr: 'Dec', - context: 'December', - abbr_context: 'Dec', - }, - weekday: { - noArgs: 'Saturday', - abbr: 'Sat', - context: 'Saturday', - abbr_context: 'Sat', - }, - birthdate: { - noArgs: new Date('1978-06-29T09:24:02.647Z'), - ageMode: new Date('1977-08-10T01:09:17.468Z'), - ageRange: new Date('1975-10-01T07:11:50.190Z'), - age: new Date('1960-01-14T18:44:13.966Z'), - yearMode: new Date('1978-06-29T09:24:02.647Z'), - yearRange: new Date('1993-10-11T07:44:59.519Z'), - year: new Date('2000-12-04T01:16:03.286Z'), - }, - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const converterMap = [ (d: Date) => d, @@ -143,7 +15,7 @@ describe('date', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { describe('past()', () => { it('should return deterministic past value on given refDate of type string', () => { @@ -151,7 +23,7 @@ describe('date', () => { const actual = faker.date.past(undefined, '2021-02-21T17:09:15.711Z'); - expect(actual).toEqual(expectations.past.noArgs); + expect(actual).toMatchSnapshot(); }); it('should return deterministic past value on given refDate of type date', () => { @@ -162,7 +34,7 @@ describe('date', () => { new Date('2021-02-21T17:09:15.711Z') ); - expect(actual).toEqual(expectations.past.noArgs); + expect(actual).toMatchSnapshot(); }); it('should return deterministic past value on given years 10 and refDate of type string', () => { @@ -170,7 +42,7 @@ describe('date', () => { const actual = faker.date.past(10, '2021-02-21T17:09:15.711Z'); - expect(actual).toEqual(expectations.past.ten); + expect(actual).toMatchSnapshot(); }); it('should return deterministic past value on given years 10 and refDate of type date', () => { @@ -181,7 +53,7 @@ describe('date', () => { new Date('2021-02-21T17:09:15.711Z') ); - expect(actual).toEqual(expectations.past.ten); + expect(actual).toMatchSnapshot(); }); }); @@ -194,7 +66,7 @@ describe('date', () => { '2021-02-21T17:09:15.711Z' ); - expect(actual).toEqual(expectations.future.noArgs); + expect(actual).toMatchSnapshot(); }); it('should return deterministic future value on given refDate of type date', () => { @@ -205,7 +77,7 @@ describe('date', () => { new Date('2021-02-21T17:09:15.711Z') ); - expect(actual).toEqual(expectations.future.noArgs); + expect(actual).toMatchSnapshot(); }); it('should return deterministic future value on given years 10 and refDate of type string', () => { @@ -213,7 +85,7 @@ describe('date', () => { const actual = faker.date.future(10, '2021-02-21T17:09:15.711Z'); - expect(actual).toEqual(expectations.future.ten); + expect(actual).toMatchSnapshot(); }); it('should return deterministic future value on given years 10 and refDate of type date', () => { @@ -224,7 +96,7 @@ describe('date', () => { new Date('2021-02-21T17:09:15.711Z') ); - expect(actual).toEqual(expectations.future.ten); + expect(actual).toMatchSnapshot(); }); }); @@ -237,7 +109,7 @@ describe('date', () => { '2021-04-21T17:11:17.711Z' ); - expect(actual).toEqual(expectations.between); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value between given real dates', () => { @@ -248,7 +120,7 @@ describe('date', () => { new Date('2021-04-21T17:11:17.711Z') ); - expect(actual).toEqual(expectations.between); + expect(actual).toMatchSnapshot(); }); }); @@ -261,7 +133,7 @@ describe('date', () => { '2021-04-21T17:11:17.711Z' ); - expect(actual).toEqual(expectations.betweens); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value betweens given dates', () => { @@ -272,7 +144,7 @@ describe('date', () => { new Date('2021-04-21T17:11:17.711Z') ); - expect(actual).toEqual(expectations.betweens); + expect(actual).toMatchSnapshot(); }); }); @@ -285,7 +157,7 @@ describe('date', () => { '2021-02-21T17:11:17.711Z' ); - expect(actual).toEqual(expectations.recent); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value recent to given refDate of type date', () => { @@ -296,7 +168,7 @@ describe('date', () => { new Date('2021-02-21T17:11:17.711Z') ); - expect(actual).toEqual(expectations.recent); + expect(actual).toMatchSnapshot(); }); }); @@ -306,7 +178,7 @@ describe('date', () => { const actual = faker.date.soon(undefined, '2021-03-13T14:16:17.151Z'); - expect(actual).toEqual(expectations.soon); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value soon to given refDate of type date', () => { @@ -317,7 +189,7 @@ describe('date', () => { new Date('2021-03-13T14:16:17.151Z') ); - expect(actual).toEqual(expectations.soon); + expect(actual).toMatchSnapshot(); }); }); @@ -327,7 +199,7 @@ describe('date', () => { const actual = faker.date.month(); - expect(actual).toEqual(expectations.month.noArgs); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value month with abbr true', () => { @@ -335,7 +207,7 @@ describe('date', () => { const actual = faker.date.month({ abbr: true }); - expect(actual).toEqual(expectations.month.abbr); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value month with context true', () => { @@ -343,7 +215,7 @@ describe('date', () => { const actual = faker.date.month({ context: true }); - expect(actual).toEqual(expectations.month.context); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value month with abbr and context true', () => { @@ -351,7 +223,7 @@ describe('date', () => { const actual = faker.date.month({ abbr: true, context: true }); - expect(actual).toEqual(expectations.month.abbr_context); + expect(actual).toMatchSnapshot(); }); }); @@ -361,7 +233,7 @@ describe('date', () => { const actual = faker.date.weekday(); - expect(actual).toEqual(expectations.weekday.noArgs); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value weekday with abbr true', () => { @@ -369,7 +241,7 @@ describe('date', () => { const actual = faker.date.weekday({ abbr: true }); - expect(actual).toEqual(expectations.weekday.abbr); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value weekday with context true', () => { @@ -377,7 +249,7 @@ describe('date', () => { const actual = faker.date.weekday({ context: true }); - expect(actual).toEqual(expectations.weekday.context); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value weekday with abbr and context true', () => { @@ -385,7 +257,7 @@ describe('date', () => { const actual = faker.date.weekday({ abbr: true, context: true }); - expect(actual).toEqual(expectations.weekday.abbr_context); + expect(actual).toMatchSnapshot(); }); }); @@ -397,7 +269,7 @@ describe('date', () => { refDate: '2000-02-09T20:54:02.397Z', }); - expect(actual).toEqual(expectations.birthdate.noArgs); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value birthdate by age mode ', () => { @@ -408,7 +280,7 @@ describe('date', () => { refDate: '2000-02-09T20:54:02.397Z', }); - expect(actual).toEqual(expectations.birthdate.ageMode); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value birthdate by age range', () => { @@ -421,7 +293,7 @@ describe('date', () => { refDate: '2000-02-09T20:54:02.397Z', }); - expect(actual).toEqual(expectations.birthdate.ageRange); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value birthdate by age', () => { @@ -434,7 +306,7 @@ describe('date', () => { refDate: '2000-02-09T20:54:02.397Z', }); - expect(actual).toEqual(expectations.birthdate.age); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value birthdate by year mode', () => { @@ -445,7 +317,7 @@ describe('date', () => { refDate: '2000-02-09T20:54:02.397Z', }); - expect(actual).toEqual(expectations.birthdate.yearMode); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value birthdate by year range', () => { @@ -458,7 +330,7 @@ describe('date', () => { refDate: '2000-02-09T20:54:02.397Z', }); - expect(actual).toEqual(expectations.birthdate.yearRange); + expect(actual).toMatchSnapshot(); }); it('should return deterministic value birthdate by year', () => { @@ -471,7 +343,7 @@ describe('date', () => { refDate: '2000-02-09T20:54:02.397Z', }); - expect(actual).toEqual(expectations.birthdate.year); + expect(actual).toMatchSnapshot(); }); }); }); diff --git a/test/finance.spec.ts b/test/finance.spec.ts index ef3fb045d72..83f997815c1 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -3,81 +3,7 @@ import { faker } from '../src'; import { FakerError } from '../src/errors/faker-error'; import ibanLib from '../src/modules/finance/iban'; import { luhnCheck } from '../src/modules/helpers/luhn-check'; - -const seedRuns = [ - { - seed: 42, - expectations: { - account: '37917755', - accountName: 'Money Market Account', - routingNumber: '379177554', - mask: '(...3791)', - amount: '374.54', - transactionType: 'withdrawal', - currencyCode: 'IQD', - currencyName: 'Iraqi Dinar', - currencySymbol: 'โ‚ฑ', - bitcoinAddress: '3XbJMAAara64sSkA9HD24YHQWd1b', - litecoinAddress: '3XbJMAAara64sSkA9HD24YHQWd1b', - creditCardNumber: '3581-7755-1410-0484', - creditCardCVV: '379', - pin: '3791', - ethereumAddress: '0x8be4abdd39321ad7d3fe01ffce404f4d6db0906b', - iban: 'GT30Y75110867098F1E3542612J4', - bic: 'UYEOSCP1514', - transactionDescription: - 'invoice transaction at Wiegand, Deckow and Renner using card ending with ***(...8361) for SDG 374.54 in account ***55141004', - }, - }, - { - seed: 1337, - expectations: { - account: '25122540', - accountName: 'Money Market Account', - routingNumber: '251225401', - mask: '(...2512)', - amount: '262.02', - transactionType: 'withdrawal', - currencyCode: 'FJD', - currencyName: 'Fiji Dollar', - currencySymbol: '$', - bitcoinAddress: '3adhxs2jewAgkYgJi7No6Cn8JZa', - litecoinAddress: 'Madhxs2jewAgkYgJi7No6Cn8JZar', - creditCardNumber: '6011-6212-2540-3255-2398', - creditCardCVV: '251', - pin: '2512', - ethereumAddress: '0x5c346ba075bd57f5a62b82d72af39cbbb07a98cb', - iban: 'FO7710540350900318', - bic: 'OEFELYL1032', - transactionDescription: - 'withdrawal transaction at Cronin - Effertz using card ending with ***(...3927) for GTQ 262.02 in account ***54032552', - }, - }, - { - seed: 1211, - expectations: { - account: '94872190', - accountName: 'Personal Loan Account', - routingNumber: '948721904', - mask: '(...9487)', - amount: '928.52', - transactionType: 'invoice', - currencyCode: 'XDR', - currencyName: 'SDR', - currencySymbol: 'โ‚ญ', - bitcoinAddress: '1TMe8Z3EaFdLqmaGKP1LEEJQVriSZRZdsA', - litecoinAddress: 'MTMe8Z3EaFdLqmaGKP1LEEJQVriSZRZds', - creditCardNumber: '4872190616274', - creditCardCVV: '948', - pin: '9487', - ethereumAddress: '0xeadb42f0e3f4a973fab0aeefce96dfcf49cd438d', - iban: 'TN0382001124170679299069', - bic: 'LXUEBTZ1', - transactionDescription: - 'deposit transaction at Trantow - Sanford using card ending with ***(...4316) for STN 928.52 in account ***19061627', - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const functionNames = [ 'account', @@ -107,7 +33,7 @@ describe('finance', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seedRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { @@ -115,7 +41,7 @@ describe('finance', () => { const actual = faker.finance[functionName](); - expect(actual).toEqual(expectations[functionName]); + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/git.spec.ts b/test/git.spec.ts index 30c00e8d98b..19c9c4ee249 100644 --- a/test/git.spec.ts +++ b/test/git.spec.ts @@ -1,69 +1,7 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - branch: { - noArgs: 'array-transmit', - }, - commitEntry: { - noArgs: '', - }, - commitMessage: { - noArgs: 'navigate neural capacitor', - }, - commitSha: { - noArgs: '5cf2bc99272107d592ba00fbdf302f2949806048', - }, - shortSha: { - noArgs: '5cf2bc9', - }, - }, - }, - { - seed: 1337, - expectations: { - branch: { - noArgs: 'port-quantify', - }, - commitEntry: { - noArgs: '', - }, - commitMessage: { - noArgs: 'compress multi-byte panel', - }, - commitSha: { - noArgs: '48234870538945f4b41c61a52bf27dccc0576698', - }, - shortSha: { - noArgs: '4823487', - }, - }, - }, - { - seed: 1211, - expectations: { - branch: { - noArgs: 'capacitor-connect', - }, - commitEntry: { - noArgs: '', - }, - commitMessage: { - noArgs: 'reboot online circuit', - }, - commitSha: { - noArgs: 'e7ec32f0a2a3c652bbd0caabde64dfdf379e3259', - }, - shortSha: { - noArgs: 'e7ec32f', - }, - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -80,10 +18,11 @@ describe('git', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { if (functionName === 'commitEntry') { + // The timestamp is not fixed, so we can't compare it. it.todo(`${functionName}()`); continue; } @@ -92,7 +31,8 @@ describe('git', () => { faker.seed(seed); const actual = faker.git[functionName](); - expect(actual).toEqual(expectations[functionName].noArgs); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/hacker.spec.ts b/test/hacker.spec.ts index d0311f724a3..ca0e686ff53 100644 --- a/test/hacker.spec.ts +++ b/test/hacker.spec.ts @@ -1,80 +1,6 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - abbreviation: { - noArgs: 'PCI', - }, - adjective: { - noArgs: 'cross-platform', - }, - noun: { - noArgs: 'array', - }, - verb: { - noArgs: 'navigate', - }, - ingverb: { - noArgs: 'copying', - }, - phrase: { - noArgs: - 'Try to transmit the SAS microchip, maybe it will quantify the mobile monitor!', - }, - }, - }, - { - seed: 1337, - expectations: { - abbreviation: { - noArgs: 'AGP', - }, - adjective: { - noArgs: 'open-source', - }, - noun: { - noArgs: 'port', - }, - verb: { - noArgs: 'compress', - }, - ingverb: { - noArgs: 'compressing', - }, - phrase: { - noArgs: - 'Try to generate the COM program, maybe it will connect the back-end port!', - }, - }, - }, - { - seed: 1211, - expectations: { - abbreviation: { - noArgs: 'JSON', - }, - adjective: { - noArgs: 'solid state', - }, - noun: { - noArgs: 'capacitor', - }, - verb: { - noArgs: 'reboot', - }, - ingverb: { - noArgs: 'programming', - }, - phrase: { - noArgs: - "I'll back up the neural RSS program, that should panel the SCSI matrix!", - }, - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -92,14 +18,15 @@ describe('name', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.hacker[functionName](); - expect(actual).toEqual(expectations[functionName].noArgs); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index f5f4e96f8ff..497fb85b669 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -1,51 +1,7 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; import { luhnCheck } from '../src/modules/helpers/luhn-check'; - -const seededRuns = [ - { - seed: 42, - expectations: { - slugify: '', - replaceSymbolWithNumber: '', - replaceSymbols: '', - replaceCreditCardSymbols: '6453-3791-7755-1410-0489', - repeatString: '', - regexpStyleStringParse: '', - shuffle: [], - uniqueArray: [], - mustache: '', - }, - }, - { - seed: 1337, - expectations: { - slugify: '', - replaceSymbolWithNumber: '', - replaceSymbols: '', - replaceCreditCardSymbols: '6453-2512-2540-3255-2399', - repeatString: '', - regexpStyleStringParse: '', - shuffle: [], - uniqueArray: [], - mustache: '', - }, - }, - { - seed: 1211, - expectations: { - slugify: '', - replaceSymbolWithNumber: '', - replaceSymbols: '', - replaceCreditCardSymbols: '6453-9487-2190-6162-7434', - repeatString: '', - regexpStyleStringParse: '', - shuffle: [], - uniqueArray: [], - mustache: '', - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -66,14 +22,15 @@ describe('helpers', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.helpers[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/internet.spec.ts b/test/internet.spec.ts index 1160538dc38..04393b90146 100644 --- a/test/internet.spec.ts +++ b/test/internet.spec.ts @@ -1,89 +1,9 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; +import { seededRuns } from './support/seededRuns'; import { times } from './support/times'; -const seededRuns = [ - { - seed: 42, - expectations: { - avatar: - 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/468.jpg', - email: 'Peyton73@yahoo.com', - exampleEmail: 'Peyton73@example.com', - userName: 'Garnett.Schinner73', - protocol: 'http', - httpMethod: 'POST', - httpStatusCode: 207, - url: 'http://stable-vehicle.biz', - domainName: 'harmonious-shift.org', - domainSuffix: 'info', - domainWord: 'harmonious-shift', - ip: '95.203.243.46', - ipv6: '5cf2:bc99:2721:07d5:92ba:00fb:df30:2f29', - port: 24545, - userAgent: - 'Mozilla/5.0 (Windows; U; Windows NT 6.2) AppleWebKit/538.0.2 (KHTML, like Gecko) Chrome/29.0.815.0 Safari/538.0.2', - color: '#30667a', - mac: '5c:f2:bc:99:27:21', - password: 'Dl2fkYYKLsZdepz', - emoji: '๐Ÿ•ธ๏ธ', - }, - }, - { - seed: 1337, - expectations: { - avatar: - 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/327.jpg', - email: 'Keith27@gmail.com', - exampleEmail: 'Keith27@example.org', - userName: 'Devyn21', - protocol: 'http', - httpMethod: 'POST', - httpStatusCode: 205, - url: 'http://neat-chopsticks.biz', - domainName: 'fabulous-might.com', - domainSuffix: 'biz', - domainWord: 'fabulous-might', - ip: '67.143.40.54', - ipv6: '4823:4870:5389:45f4:b41c:61a5:2bf2:7dcc', - port: 17172, - userAgent: - 'Mozilla/5.0 (Windows; U; Windows NT 6.1) AppleWebKit/532.0.0 (KHTML, like Gecko) Chrome/13.0.832.0 Safari/532.0.0', - color: '#214814', - mac: '48:23:48:70:53:89', - password: '9V05TL7RY9fmECg', - emoji: '๐Ÿ’‡๐Ÿผโ€โ™€๏ธ', - }, - }, - { - seed: 1211, - expectations: { - avatar: - 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1160.jpg', - email: 'Jadon.Trantow12@hotmail.com', - exampleEmail: 'Jadon.Trantow12@example.net', - userName: 'Tito_Koch22', - protocol: 'https', - httpMethod: 'PATCH', - httpStatusCode: 505, - url: 'https://joyous-temperature.net', - domainName: 'verifiable-infection.org', - domainSuffix: 'org', - domainWord: 'verifiable-infection', - ip: '237.117.228.199', - ipv6: 'e7ec:32f0:a2a3:c652:bbd0:caab:de64:dfdf', - port: 60851, - userAgent: - 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6 rv:3.0; PT) AppleWebKit/538.2.0 (KHTML, like Gecko) Version/4.1.0 Safari/538.2.0', - color: '#773a72', - mac: 'e7:ec:32:f0:a2:a3', - password: 'yLuj60b5iHB0bhn', - emoji: '๐Ÿ‡ฎ๐Ÿ‡ธ', - }, - }, -]; - const NON_SEEDED_BASED_RUN = 5; const functionNames = [ @@ -113,15 +33,15 @@ describe('internet', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.internet[functionName](); - expect(actual).toBeTruthy(); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/lorem.spec.ts b/test/lorem.spec.ts index 1338e366502..17721b92ba0 100644 --- a/test/lorem.spec.ts +++ b/test/lorem.spec.ts @@ -1,88 +1,9 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; +import { seededRuns } from './support/seededRuns'; import { times } from './support/times'; -const seededRuns = [ - { - seed: 42, - expectations: { - word: 'autem', - words: 'autem quibusdam hic', - sentence: 'Quibusdam hic sit minus dolor.', - slug: 'autem-quibusdam-hic', - sentences: - 'Hic sit minus dolor animi mollitia sequi ducimus sequi. Inventore praesentium et. Animi qui impedit et voluptatem.', - paragraph: - 'Hic sit minus dolor animi mollitia sequi ducimus sequi. Inventore praesentium et. Animi qui impedit et voluptatem. Ut quisquam fugiat.', - paragraphs: [ - 'Hic sit minus dolor animi mollitia sequi ducimus sequi. Inventore praesentium et. Animi qui impedit et voluptatem. Ut quisquam fugiat.', - 'Alias sit asperiores sit. Corporis laborum cupiditate consequatur et voluptatem nostrum. Laborum in eos quae nostrum aut consequatur. Blanditiis sunt repellendus et. Eum sint voluptatibus deserunt. Quae eos est soluta ipsum qui.', - 'Hic earum delectus. Consequatur eum corporis perferendis aspernatur incidunt nobis. Odio nobis quia est.', - ].join('\n'), - text: 'Hic sit minus dolor animi mollitia sequi ducimus sequi.', - lines: [ - 'Hic sit minus dolor animi mollitia sequi ducimus sequi.', - 'Inventore praesentium et.', - ].join('\n'), - }, - }, - { - seed: 1337, - expectations: { - word: 'voluptatem', - words: 'voluptatem natus nesciunt', - sentence: 'Natus nesciunt non minima perspiciatis.', - slug: 'voluptatem-natus-nesciunt', - sentences: - 'Nesciunt non minima perspiciatis praesentium aperiam voluptatem. Occaecati deserunt voluptatem suscipit. Enim minus nemo fugit et iure explicabo et commodi consequuntur.', - paragraph: - 'Nesciunt non minima perspiciatis praesentium aperiam voluptatem. Occaecati deserunt voluptatem suscipit. Enim minus nemo fugit et iure explicabo et commodi consequuntur. Voluptatibus nesciunt dignissimos eos temporibus temporibus autem consequatur.', - paragraphs: [ - 'Nesciunt non minima perspiciatis praesentium aperiam voluptatem. Occaecati deserunt voluptatem suscipit. Enim minus nemo fugit et iure explicabo et commodi consequuntur. Voluptatibus nesciunt dignissimos eos temporibus temporibus autem consequatur.', - 'Esse vel qui occaecati omnis quis. Voluptatum quis et libero. Et odio dolor qui velit qui. Eveniet provident non fugiat.', - 'A a aut nihil. Quas eligendi excepturi eligendi perferendis quo minus et asperiores. Neque blanditiis consequuntur esse autem harum eligendi aut. Cum consequatur pariatur. Omnis temporibus sapiente.', - ].join('\n'), - text: 'natus nesciunt non', - lines: [ - 'Nesciunt non minima perspiciatis praesentium aperiam voluptatem.', - 'Occaecati deserunt voluptatem suscipit.', - ].join('\n'), - }, - }, - { - seed: 1211, - expectations: { - word: 'non', - words: 'non praesentium saepe', - sentence: - 'Praesentium saepe omnis tempora magni repellat eaque tempore nesciunt nobis.', - slug: 'non-praesentium-saepe', - sentences: - 'Saepe omnis tempora magni repellat eaque. Nesciunt nobis non voluptas quam ex neque eligendi. Vel perferendis assumenda nam expedita est eum molestiae. Ullam et maiores vero doloribus eius. Officia et velit voluptatem quis dolorum. Dignissimos voluptas aut qui corporis itaque sit provident quam aut.', - paragraph: - 'Saepe omnis tempora magni repellat eaque. Nesciunt nobis non voluptas quam ex neque eligendi. Vel perferendis assumenda nam expedita est eum molestiae. Ullam et maiores vero doloribus eius. Officia et velit voluptatem quis dolorum. Dignissimos voluptas aut qui corporis itaque sit provident quam aut.', - paragraphs: [ - 'Saepe omnis tempora magni repellat eaque. Nesciunt nobis non voluptas quam ex neque eligendi. Vel perferendis assumenda nam expedita est eum molestiae. Ullam et maiores vero doloribus eius. Officia et velit voluptatem quis dolorum. Dignissimos voluptas aut qui corporis itaque sit provident quam aut.', - 'In ullam quia impedit. Occaecati repudiandae ut maiores pariatur enim. Deserunt voluptatem in enim in quia.', - 'Ut eligendi tempora eos ipsa cumque nulla. Quidem et sed voluptate et quia. Nulla esse in similique deleniti beatae eaque.', - ].join('\n'), - text: [ - 'Omnis tempora magni repellat eaque tempore nesciunt nobis non voluptas.', - 'Ex neque eligendi placeat vel perferendis.', - 'Nam expedita est eum molestiae iusto ullam et maiores.', - ].join('\n'), - lines: [ - 'Saepe omnis tempora magni repellat eaque.', - 'Nesciunt nobis non voluptas quam ex neque eligendi.', - 'Vel perferendis assumenda nam expedita est eum molestiae.', - 'Ullam et maiores vero doloribus eius.', - 'Officia et velit voluptatem quis dolorum.', - ].join('\n'), - }, - }, -]; - const NON_SEEDED_BASED_RUN = 5; const functionNames = [ @@ -102,7 +23,7 @@ describe('lorem', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { @@ -110,9 +31,8 @@ describe('lorem', () => { const actual = faker.lorem[functionName](); - expect(actual).toBeTruthy(); expect(actual).toBeTypeOf('string'); - expect(actual).toEqual(expectations[functionName]); + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/mersenne.spec.ts b/test/mersenne.spec.ts index 4097b1e0abf..4ed803af823 100644 --- a/test/mersenne.spec.ts +++ b/test/mersenne.spec.ts @@ -1,97 +1,12 @@ import { beforeAll, beforeEach, describe, expect, it } from 'vitest'; import { FakerError } from '../src/errors/faker-error'; import { Mersenne } from '../src/modules/mersenne'; +import { seededRuns } from './support/seededRuns'; -type SeededRun = { - seed: number | number[]; - expectations: SeededRunExpectations; -}; -type SeededRunExpectations = { - rand: { - noArgs: number; - minMax: { max?: number; min?: number; expected?: number }[]; - }; -}; - -const seededRuns: SeededRun[] = [ - { - seed: 42, - expectations: { - rand: { - noArgs: 12272, - minMax: [ - { max: 100, min: 0, expected: 37 }, - { max: undefined, min: 0, expected: 12272 }, - { max: 100, min: undefined, expected: 37 }, - ], - }, - }, - }, - { - seed: 1337, - expectations: { - rand: { - noArgs: 8586, - minMax: [ - { max: 100, min: 0, expected: 26 }, - { max: undefined, min: 0, expected: 8586 }, - { max: 100, min: undefined, expected: 26 }, - ], - }, - }, - }, - { - seed: 1211, - expectations: { - rand: { - noArgs: 30425, - minMax: [ - { max: 100, min: 0, expected: 92 }, - { max: undefined, min: 0, expected: 30425 }, - { max: 100, min: undefined, expected: 92 }, - ], - }, - }, - }, - { - seed: [42, 1, 2], - expectations: { - rand: { - noArgs: 28056, - minMax: [ - { max: 100, min: 0, expected: 85 }, - { max: undefined, min: 0, expected: 28056 }, - { max: 100, min: undefined, expected: 85 }, - ], - }, - }, - }, - { - seed: [1337, 1, 2], - expectations: { - rand: { - noArgs: 5895, - minMax: [ - { max: 100, min: 0, expected: 17 }, - { max: undefined, min: 0, expected: 5895 }, - { max: 100, min: undefined, expected: 17 }, - ], - }, - }, - }, - { - seed: [1211, 1, 2], - expectations: { - rand: { - noArgs: 29217, - minMax: [ - { max: 100, min: 0, expected: 89 }, - { max: undefined, min: 0, expected: 29217 }, - { max: 100, min: undefined, expected: 89 }, - ], - }, - }, - }, +const minMaxTestCases = [ + { max: 100, min: 0 }, + { max: undefined, min: 0 }, + { max: 100, min: undefined }, ]; const functionNames = ['rand']; @@ -105,7 +20,7 @@ describe('mersenne twister', () => { mersenne = new Mersenne(); }); - for (const { seed, expectations } of seededRuns) { + for (const seed of [...seededRuns, [42, 1, 2], [1337, 1, 2], [1211, 1, 2]]) { describe(`seed: ${JSON.stringify(seed)}`, () => { beforeEach(() => { if (Array.isArray(seed)) { @@ -119,15 +34,15 @@ describe('mersenne twister', () => { it(`${functionName}()`, () => { const actual = mersenne[functionName](); - expect(actual).toEqual(expectations[functionName].noArgs); + expect(actual).toMatchSnapshot(); }); } - for (const { min, max, expected } of expectations.rand.minMax) { - it(`should return ${expected} for rand(${max}, ${min})`, () => { + for (const { min, max } of minMaxTestCases) { + it(`should return deterministic values for rand(${max}, ${min})`, () => { const actual = mersenne.rand(max, min); - expect(actual).toEqual(expected); + expect(actual).toMatchSnapshot(); }); } diff --git a/test/music.spec.ts b/test/music.spec.ts index 561ddf02f5a..40b24854dbf 100644 --- a/test/music.spec.ts +++ b/test/music.spec.ts @@ -1,41 +1,6 @@ import { beforeEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - genre: { - noArgs: 'Country', - }, - songName: { - noArgs: 'Only The Lonely (Know The Way I Feel)', - }, - }, - }, - { - seed: 1337, - expectations: { - genre: { - noArgs: 'Folk', - }, - songName: { - noArgs: 'Turn! Turn! Turn! (To Everything There is a Season)', - }, - }, - }, - { - seed: 1211, - expectations: { - genre: { - noArgs: 'Non Music', - }, - songName: { - noArgs: 'The End of the World', - }, - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const functionNames = ['genre', 'songName']; @@ -46,7 +11,7 @@ describe('music', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { @@ -54,7 +19,7 @@ describe('music', () => { const actual = faker.music[functionName](); - expect(actual).toEqual(expectations[functionName].noArgs); + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/name.spec.ts b/test/name.spec.ts index 3354f9f7650..1d9f44219b2 100644 --- a/test/name.spec.ts +++ b/test/name.spec.ts @@ -1,122 +1,6 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - firstName: { - noArgs: 'Garnett', - }, - lastName: { - noArgs: 'Hintz', - }, - middleName: { - noArgs: 'Greer', - }, - findName: { - noArgs: 'Sadie Wiegand', - }, - jobTitle: { - noArgs: 'Regional Data Representative', - }, - gender: { - noArgs: 'Cis', - }, - prefix: { - noArgs: 'Mrs.', - }, - suffix: { - noArgs: 'III', - }, - jobDescriptor: { - noArgs: 'Regional', - }, - jobArea: { - noArgs: 'Identity', - }, - jobType: { - noArgs: 'Coordinator', - }, - }, - }, - { - seed: 1337, - expectations: { - firstName: { - noArgs: 'Devyn', - }, - lastName: { - noArgs: 'Gibson', - }, - middleName: { - noArgs: 'Dakota', - }, - findName: { - noArgs: 'Leona Cronin', - }, - jobTitle: { - noArgs: 'Future Infrastructure Liaison', - }, - gender: { - noArgs: 'Two* person', - }, - prefix: { - noArgs: 'Mrs.', - }, - suffix: { - noArgs: 'I', - }, - jobDescriptor: { - noArgs: 'Future', - }, - jobArea: { - noArgs: 'Functionality', - }, - jobType: { - noArgs: 'Engineer', - }, - }, - }, - { - seed: 1211, - expectations: { - firstName: { - noArgs: 'Tito', - }, - lastName: { - noArgs: 'Ward', - }, - middleName: { - noArgs: 'Sawyer', - }, - findName: { - noArgs: 'Claude Trantow', - }, - jobTitle: { - noArgs: 'Chief Division Agent', - }, - gender: { - noArgs: 'Transexual Person', - }, - prefix: { - noArgs: 'Dr.', - }, - suffix: { - noArgs: 'DVM', - }, - jobDescriptor: { - noArgs: 'Chief', - }, - jobArea: { - noArgs: 'Factors', - }, - jobType: { - noArgs: 'Representative', - }, - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -140,14 +24,15 @@ describe('name', () => { faker.localeFallback = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.name[functionName](); - expect(actual).toEqual(expectations[functionName].noArgs); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/phone.spec.ts b/test/phone.spec.ts index daccd63b687..2cea76c2d50 100644 --- a/test/phone.spec.ts +++ b/test/phone.spec.ts @@ -1,72 +1,7 @@ import { beforeEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; import { luhnCheck } from '../src/modules/helpers/luhn-check'; - -const seededRuns = [ - { - seed: 42, - expectations: { - phoneNumber: { - noArgs: '891.775.5141', - }, - number: { - noArgs: '891.775.5141', - }, - phoneNumberFormat: { - noArgs: '479-377-5514', - phoneFormatsArrayIndex: { arrayIndex: 1, expected: '(479) 377-5514' }, - }, - phoneFormats: { - noArgs: '!##.!##.####', - }, - imei: { - noArgs: '37-917755-141004-5', - }, - }, - }, - { - seed: 1337, - expectations: { - phoneNumber: { - noArgs: '(612) 454-0325', - }, - number: { - noArgs: '(612) 454-0325', - }, - phoneNumberFormat: { - noArgs: '451-325-4032', - phoneFormatsArrayIndex: { arrayIndex: 1, expected: '(451) 325-4032' }, - }, - phoneFormats: { - noArgs: '(!##) !##-####', - }, - imei: { - noArgs: '25-122540-325523-4', - }, - }, - }, - { - seed: 1211, - expectations: { - phoneNumber: { - noArgs: '1-587-319-0616 x27431', - }, - number: { - noArgs: '1-587-319-0616 x27431', - }, - phoneNumberFormat: { - noArgs: '948-821-9061', - phoneFormatsArrayIndex: { arrayIndex: 1, expected: '(948) 821-9061' }, - }, - phoneFormats: { - noArgs: '1-!##-!##-#### x#####', - }, - imei: { - noArgs: '94-872190-616274-4', - }, - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const functionNames = [ 'phoneNumber', @@ -83,7 +18,7 @@ describe('phone', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { @@ -91,20 +26,21 @@ describe('phone', () => { const actual = faker.phone[functionName](); - expect(actual).toEqual(expectations[functionName].noArgs); + expect(actual).toMatchSnapshot(); }); } describe('phoneNumberFormat', () => { - const { arrayIndex, expected } = - expectations.phoneNumberFormat.phoneFormatsArrayIndex; - it(`should return ${expected} for ${arrayIndex}`, () => { - faker.seed(seed); + it.each([1, 2, 3, 4])( + `should return deterministic values for %s`, + (index) => { + faker.seed(seed); - const actual = faker.phone.phoneNumberFormat(arrayIndex); + const actual = faker.phone.phoneNumberFormat(index); - expect(actual).toEqual(expected); - }); + expect(actual).toMatchSnapshot(); + } + ); }); }); } diff --git a/test/random.spec.ts b/test/random.spec.ts index fc57ca435b0..4eedf6aec50 100644 --- a/test/random.spec.ts +++ b/test/random.spec.ts @@ -1,43 +1,8 @@ import { beforeEach, describe, expect, it } from 'vitest'; import { faker, FakerError } from '../src'; +import { seededRuns } from './support/seededRuns'; import { times } from './support/times'; -const seededRuns = [ - { - seed: 42, - expectations: { - alpha: 'j', - alphaNumeric: 'd', - locale: 'es_MX', - numeric: '4', - word: 'extend', - words: 'mobile Fish', - }, - }, - { - seed: 1337, - expectations: { - alpha: 'g', - alphaNumeric: '9', - locale: 'en_GH', - numeric: '3', - word: 'leading', - words: 'Delaware', - }, - }, - { - seed: 1211, - expectations: { - alpha: 'y', - alphaNumeric: 'x', - locale: 'ur', - numeric: '9', - word: 'Division', - words: 'Turnpike Frozen Handcrafted', - }, - }, -]; - const NON_SEEDED_BASED_RUN = 5; const functionNames = [ @@ -50,14 +15,15 @@ const functionNames = [ ]; describe('random', () => { - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.random[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/science.spec.ts b/test/science.spec.ts index 614f269cf2d..f7f51d6b84b 100644 --- a/test/science.spec.ts +++ b/test/science.spec.ts @@ -1,50 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - chemicalElement: { - symbol: 'Rh', - name: 'Rhodium', - atomicNumber: 45, - }, - unit: { - name: 'hertz', - symbol: 'Hz', - }, - }, - }, - { - seed: 1337, - expectations: { - chemicalElement: { - symbol: 'Ga', - name: 'Gallium', - atomicNumber: 31, - }, - unit: { - name: 'candela', - symbol: 'cd', - }, - }, - }, - { - seed: 1211, - expectations: { - chemicalElement: { - symbol: 'Ds', - name: 'Darmstadtium', - atomicNumber: 110, - }, - unit: { - name: 'gray', - symbol: 'Gy', - }, - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -55,14 +11,15 @@ describe('science', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.science[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/support/seededRuns.ts b/test/support/seededRuns.ts new file mode 100644 index 00000000000..6e6539b78a2 --- /dev/null +++ b/test/support/seededRuns.ts @@ -0,0 +1 @@ +export const seededRuns = [42, 1337, 1211]; diff --git a/test/system.spec.ts b/test/system.spec.ts index dc584ee6fde..559d7bed7c2 100644 --- a/test/system.spec.ts +++ b/test/system.spec.ts @@ -1,54 +1,7 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - fileName: 'mobile_fish.jxsc', - commonFileName: 'mobile_fish.mpe', - mimeType: 'application/vnd.ibm.rights-management', - commonFileType: 'audio', - commonFileExt: 'png', - fileType: 'image', - fileExt: 'lrm', - directoryPath: '/opt/bin', - filePath: '/opt/bin/directives_application_home.ptid', - semver: '3.7.9', - }, - }, - { - seed: 1337, - expectations: { - fileName: 'delaware.cmc', - commonFileName: 'delaware.mp2', - mimeType: 'application/vnd.chipnuts.karaoke-mmd', - commonFileType: 'audio', - commonFileExt: 'wav', - fileType: 'font', - fileExt: 'oa3', - directoryPath: '/Library', - filePath: '/Library/bike_interactive.link66', - semver: '2.5.1', - }, - }, - { - seed: 1211, - expectations: { - fileName: 'turnpike_frozen_handcrafted.heifs', - commonFileName: 'turnpike_frozen_handcrafted.mp4v', - mimeType: 'text/vnd.dmclientscript', - commonFileType: 'application', - commonFileExt: 'htm', - fileType: 'x-shader', - fileExt: 'dic', - directoryPath: '/var/log', - filePath: '/var/log/forward_supervisor.z2', - semver: '9.4.8', - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -70,14 +23,15 @@ describe('system', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.system[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/unique.spec.ts b/test/unique.spec.ts index 909b26a4329..273526d031c 100644 --- a/test/unique.spec.ts +++ b/test/unique.spec.ts @@ -1,33 +1,7 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; import { FakerError } from '../src/errors/faker-error'; - -const seededRuns = [ - { - seed: 42, - expectations: { - withCustomMethod: 'Test-188', - withNumberMethod: 37454, - withNumberMethodAndArgs: 19, - }, - }, - { - seed: 1337, - expectations: { - withCustomMethod: 'Test-132', - withNumberMethod: 26202, - withNumberMethodAndArgs: 13, - }, - }, - { - seed: 1211, - expectations: { - withCustomMethod: 'Test-465', - withNumberMethod: 92852, - withNumberMethodAndArgs: 47, - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -46,13 +20,14 @@ describe('unique', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { it('unique(customMethod)', () => { faker.seed(seed); const actual = faker.unique(customMethod); - expect(actual).toEqual(expectations.withCustomMethod); + + expect(actual).toMatchSnapshot(); }); it('unique(customMethod, args)', () => { @@ -61,21 +36,24 @@ describe('unique', () => { const prefix = 'prefix-1-'; const actual = faker.unique(customMethod, [prefix]); - expect(actual).toEqual(prefix + expectations.withCustomMethod); + + expect(actual).toMatchSnapshot(); }); it('unique(() => number)', () => { faker.seed(seed); const actual = faker.unique(faker.datatype.number); - expect(actual).toEqual(expectations.withNumberMethod); + + expect(actual).toMatchSnapshot(); }); it('unique(() => number), args)', () => { faker.seed(seed); const actual = faker.unique(faker.datatype.number, [50]); - expect(actual).toEqual(expectations.withNumberMethodAndArgs); + + expect(actual).toMatchSnapshot(); }); }); } diff --git a/test/vehicle.spec.ts b/test/vehicle.spec.ts index a9c69b0a3d3..c8cb9ae4df5 100644 --- a/test/vehicle.spec.ts +++ b/test/vehicle.spec.ts @@ -1,50 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - vehicle: 'Ford Golf', - manufacturer: 'Ford', - model: 'Escalade', - type: 'Extended Cab Pickup', - fuel: 'Electric', - vin: 'CTY6RSKK5ED315227', - color: 'grey', - vrm: 'JU91TUP', - bicycle: 'Fitness Bicycle', - }, - }, - { - seed: 1337, - expectations: { - vehicle: 'Dodge Model S', - manufacturer: 'Dodge', - model: 'Colorado', - type: 'Coupe', - fuel: 'Electric', - vin: '8J579HF1A7MK33574', - color: 'black', - vrm: 'GO12HOL', - bicycle: 'Cyclocross Bicycle', - }, - }, - { - seed: 1211, - expectations: { - vehicle: 'Toyota Challenger', - manufacturer: 'Toyota', - model: '2', - type: 'Wagon', - fuel: 'Hybrid', - vin: 'XFWS74Z1N5S678767', - color: 'azure', - vrm: 'YL87FDZ', - bicycle: 'Triathlon/Time Trial Bicycle', - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -65,14 +21,15 @@ describe('vehicle', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { faker.seed(seed); const actual = faker.vehicle[functionName](); - expect(actual).toEqual(expectations[functionName]); + + expect(actual).toMatchSnapshot(); }); } }); diff --git a/test/word.spec.ts b/test/word.spec.ts index f3ef451c202..f3508c380fd 100644 --- a/test/word.spec.ts +++ b/test/word.spec.ts @@ -1,128 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../src'; - -const seededRuns = [ - { - seed: 42, - expectations: { - adjective: { - noArgs: 'harmonious', - length10: 'gregarious', - length20: 'harmonious', - }, - adverb: { - noArgs: 'jealously', - length10: 'generously', - length20: 'jealously', - }, - conjunction: { - noArgs: 'however', - length10: 'as much as', - length20: 'however', - }, - interjection: { - noArgs: 'yahoo', - length10: 'yahoo', - length20: 'yahoo', - }, - noun: { - noArgs: 'gale', - length10: 'exposition', - length20: 'gale', - }, - preposition: { - noArgs: 'concerning', - length10: 'throughout', - length20: 'concerning', - }, - verb: { - noArgs: 'function', - length10: 'exasperate', - length20: 'function', - }, - }, - }, - { - seed: 1337, - expectations: { - adjective: { - noArgs: 'fabulous', - length10: 'enchanting', - length20: 'fabulous', - }, - adverb: { - noArgs: 'frankly', - length10: 'enormously', - length20: 'frankly', - }, - conjunction: { - noArgs: 'even if', - length10: 'as long as', - length20: 'even if', - }, - interjection: { - noArgs: 'ew', - length10: 'ew', - length20: 'ew', - }, - noun: { - noArgs: 'digit', - length10: 'depressive', - length20: 'digit', - }, - preposition: { - noArgs: 'barring', - length10: 'concerning', - length20: 'barring', - }, - verb: { - noArgs: 'dispense', - length10: 'demoralize', - length20: 'dispense', - }, - }, - }, - { - seed: 1211, - expectations: { - adjective: { - noArgs: 'verifiable', - length10: 'unfinished', - length20: 'verifiable', - }, - adverb: { - noArgs: 'viciously', - length10: 'unbearably', - length20: 'viciously', - }, - conjunction: { - noArgs: 'whereas', - length10: 'as soon as', - length20: 'whereas', - }, - interjection: { - noArgs: 'er', - length10: 'er', - length20: 'er', - }, - noun: { - noArgs: 'trick', - length10: 'trafficker', - length20: 'trick', - }, - preposition: { - noArgs: 'upon', - length10: 'underneath', - length20: 'upon', - }, - verb: { - noArgs: 'trick', - length10: 'trampoline', - length20: 'trick', - }, - }, - }, -]; +import { seededRuns } from './support/seededRuns'; const NON_SEEDED_BASED_RUN = 5; @@ -141,7 +19,7 @@ describe('word', () => { faker.locale = 'en'; }); - for (const { seed, expectations } of seededRuns) { + for (const seed of seededRuns) { describe(`seed: ${seed}`, () => { for (const functionName of functionNames) { it(`${functionName}()`, () => { @@ -149,9 +27,8 @@ describe('word', () => { const actual = faker.word[functionName](); - expect(actual).toBeTruthy(); expect(actual).toBeTypeOf('string'); - expect(actual).toEqual(expectations[functionName].noArgs); + expect(actual).toMatchSnapshot(); }); it(`${functionName}(10)`, () => { @@ -159,9 +36,8 @@ describe('word', () => { const actual = faker.word[functionName](10); - expect(actual).toBeTruthy(); expect(actual).toBeTypeOf('string'); - expect(actual).toEqual(expectations[functionName].length10); + expect(actual).toMatchSnapshot(); }); it(`${functionName}(20)`, () => { @@ -169,9 +45,8 @@ describe('word', () => { const actual = faker.word[functionName](20); - expect(actual).toBeTruthy(); expect(actual).toBeTypeOf('string'); - expect(actual).toEqual(expectations[functionName].length20); + expect(actual).toMatchSnapshot(); }); } });