Skip to content

Commit

Permalink
feat(commerce): more varied product descriptions
Browse files Browse the repository at this point in the history
fix faker-js#2871

samples:
```
Sleek Chips designed with Concrete for substantial performance
Kuhn and Sons's most advanced Soap technology increases better capabilities
New magenta Hat with ergonomic design for worthwhile comfort
Ergonomic Car made with Granite for all-day somber support
New Chicken model with 28 GB RAM, 969 GB storage, and winding features
Stylish Table designed to make you stand out with dark looks
The Enterprise-wide dedicated groupware Chips offers reliable performance and empty design
Professional-grade Pizza perfect for same training and recreational use
The Jessika Ball is the latest in a series of bleak products from Hickle, Langworth and Jaskolski
Innovative Chips featuring authentic technology and Rubber construction
Discover the young new Shoes with an exciting mix of Fresh ingredients
The sleek and gigantic Pizza comes with purple LED lighting for smart functionality
Introducing the Japan-inspired Mouse, blending better style with local craftsmanship
Our fish-friendly Tuna ensures meager comfort for your pets
Experience the plum brilliance of our Chair, perfect for shoddy environments
Savor the fluffy essence in our Cheese, designed for mediocre culinary adventures
Featuring Vanadium-enhanced technology, our Shoes offers unparalleled muted performance
The tan Keyboard combines Gibraltar aesthetics with Argon-based durability
Our delicious-inspired Computer brings a taste of luxury to your all lifestyle
Discover the lion-like agility of our Keyboard, perfect for valuable users
```
  • Loading branch information
matthewmayer committed Oct 12, 2024
1 parent 25506d2 commit 6c15cde
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
32 changes: 20 additions & 12 deletions src/locales/en/commerce/product_description.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
export default [
'Andy shoes are designed to keeping in mind durability as well as trends, the most stylish range of shoes & sandals',
"Boston's most advanced compression wear technology increases muscle oxygenation, stabilizes active muscles",
'Carbonite web goalkeeper gloves are ergonomically designed to give easy fit',
'Ergonomic executive chair upholstered in bonded black leather and PVC padded seat and back for all-day comfort and support',
'New ABC 13 9370, 13.3, 5th Gen CoreA5-8250U, 8GB RAM, 256GB SSD, power UHD Graphics, OS 10 Home, OS Office A & J 2016',
'New range of formal shirts are designed keeping you in mind. With fits and styling that will make you stand apart',
'The Apollotech B340 is an affordable wireless mouse with reliable connectivity, 12 months battery life and modern design',
'The Football Is Good For Training And Recreational Purposes',
'The Nagasaki Lander is the trademarked name of several series of Nagasaki sport bikes, that started with the 1984 ABC800J',
'The automobile layout consists of a front-engine design, with transaxle-type transmissions mounted at the rear of the engine and four wheel drive',
'The beautiful range of Apple Naturalé that has an exciting mix of natural ingredients. With the Goodness of 100% Natural Ingredients',
'The slim & simple Maple Gaming Keyboard from Dev Byte comes with a sleek body and 7- Color RGB LED Back-lighting for smart functionality',
'{{commerce.productAdjective}} {{commerce.product}} designed with {{commerce.productMaterial}} for {{word.adjective}} performance',
"{{company.name}}'s most advanced {{commerce.product}} technology increases {{word.adjective}} capabilities",
'New {{color.human}} {{commerce.product}} with ergonomic design for {{word.adjective}} comfort',
'Ergonomic {{commerce.product}} made with {{commerce.productMaterial}} for all-day {{word.adjective}} support',
'New {{commerce.product}} model with {{number.int({"min": 1, "max": 100})}} GB RAM, {{number.int({"min": 1, "max": 1000})}} GB storage, and {{word.adjective}} features',
'Stylish {{commerce.product}} designed to make you stand out with {{word.adjective}} looks',
'The {{company.catchPhrase}} {{commerce.product}} offers reliable performance and {{word.adjective}} design',
'Professional-grade {{commerce.product}} perfect for {{word.adjective}} training and recreational use',
'The {{person.firstName}} {{commerce.product}} is the latest in a series of {{word.adjective}} products from {{company.name}}',
'Innovative {{commerce.product}} featuring {{word.adjective}} technology and {{commerce.productMaterial}} construction',
'Discover the {{word.adjective}} new {{commerce.product}} with an exciting mix of {{commerce.productMaterial}} ingredients',
'The sleek and {{word.adjective}} {{commerce.product}} comes with {{color.human}} LED lighting for smart functionality',
'Introducing the {{location.country}}-inspired {{commerce.product}}, blending {{word.adjective}} style with local craftsmanship',
'Our {{animal.type}}-friendly {{commerce.product}} ensures {{word.adjective}} comfort for your pets',
'Experience the {{color.human}} brilliance of our {{commerce.product}}, perfect for {{word.adjective}} environments',
'Savor the {{food.adjective}} essence in our {{commerce.product}}, designed for {{word.adjective}} culinary adventures',
'Featuring {{science.chemical_element.name}}-enhanced technology, our {{commerce.product}} offers unparalleled {{word.adjective}} performance',
'The {{color.human}} {{commerce.product}} combines {{location.country}} aesthetics with {{science.chemical_element.name}}-based durability',
'Our {{food.adjective}}-inspired {{commerce.product}} brings a taste of luxury to your {{word.adjective}} lifestyle',
'Discover the {{animal.type}}-like agility of our {{commerce.product}}, perfect for {{word.adjective}} users',
];
4 changes: 2 additions & 2 deletions src/modules/commerce/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,12 @@ export class CommerceModule extends ModuleBase {
* Returns a product description.
*
* @example
* faker.commerce.productDescription() // 'Andy shoes are designed to keeping...'
* faker.commerce.productDescription() // 'Featuring Phosphorus-enhanced technology, our Fish offers unparalleled Modern performance'
*
* @since 5.0.0
*/
productDescription(): string {
return this.faker.helpers.arrayElement(
return this.faker.helpers.fake(
this.faker.definitions.commerce.product_description
);
}
Expand Down
6 changes: 3 additions & 3 deletions test/modules/__snapshots__/commerce.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports[`commerce > 42 > product 1`] = `"Computer"`;

exports[`commerce > 42 > productAdjective 1`] = `"Handcrafted"`;

exports[`commerce > 42 > productDescription 1`] = `"New ABC 13 9370, 13.3, 5th Gen CoreA5-8250U, 8GB RAM, 256GB SSD, power UHD Graphics, OS 10 Home, OS Office A & J 2016"`;
exports[`commerce > 42 > productDescription 1`] = `"Professional-grade Towels perfect for pastel training and recreational use"`;

exports[`commerce > 42 > productMaterial 1`] = `"Frozen"`;

Expand Down Expand Up @@ -66,7 +66,7 @@ exports[`commerce > 1211 > product 1`] = `"Towels"`;

exports[`commerce > 1211 > productAdjective 1`] = `"Tasty"`;

exports[`commerce > 1211 > 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 > 1211 > productDescription 1`] = `"Our delicious-inspired Tuna brings a taste of luxury to your right lifestyle"`;

exports[`commerce > 1211 > productMaterial 1`] = `"Wooden"`;

Expand Down Expand Up @@ -102,7 +102,7 @@ exports[`commerce > 1337 > product 1`] = `"Chicken"`;

exports[`commerce > 1337 > productAdjective 1`] = `"Generic"`;

exports[`commerce > 1337 > productDescription 1`] = `"Ergonomic executive chair upholstered in bonded black leather and PVC padded seat and back for all-day comfort and support"`;
exports[`commerce > 1337 > productDescription 1`] = `"Stylish Car designed to make you stand out with lawful looks"`;

exports[`commerce > 1337 > productMaterial 1`] = `"Fresh"`;

Expand Down
7 changes: 3 additions & 4 deletions test/modules/commerce.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,10 @@ describe('commerce', () => {
});

describe(`productDescription()`, () => {
it('should return random value from product description array', () => {
it('should return a product description string', () => {
const actual = faker.commerce.productDescription();
expect(faker.definitions.commerce.product_description).toContain(
actual
);
expect(actual).toBeTruthy();
expect(actual).toBeTypeOf('string');
});
});

Expand Down

0 comments on commit 6c15cde

Please sign in to comment.