Skip to content

Commit

Permalink
feat(commerce): more varied product descriptions (#3174)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmayer authored Oct 16, 2024
1 parent 6a9ca8a commit ba4ef9a
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',
'Discover the {{animal.type}}-like agility of our {{commerce.product}}, perfect for {{word.adjective}} users',
'Discover the {{word.adjective}} new {{commerce.product}} with an exciting mix of {{commerce.productMaterial}} ingredients',
'Ergonomic {{commerce.product}} made with {{commerce.productMaterial}} for all-day {{word.adjective}} support',
'Experience the {{color.human}} brilliance of our {{commerce.product}}, perfect for {{word.adjective}} environments',
'Featuring {{science.chemical_element.name}}-enhanced technology, our {{commerce.product}} offers unparalleled {{word.adjective}} performance',
'Innovative {{commerce.product}} featuring {{word.adjective}} technology and {{commerce.productMaterial}} construction',
'Introducing the {{location.country}}-inspired {{commerce.product}}, blending {{word.adjective}} style with local craftsmanship',
'New {{color.human}} {{commerce.product}} with ergonomic design for {{word.adjective}} comfort',
'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',
'Our {{animal.type}}-friendly {{commerce.product}} ensures {{word.adjective}} comfort for your pets',
'Our {{food.adjective}}-inspired {{commerce.product}} brings a taste of luxury to your {{word.adjective}} lifestyle',
'Professional-grade {{commerce.product}} perfect for {{word.adjective}} training and recreational use',
'Savor the {{food.adjective}} essence in our {{commerce.product}}, designed for {{word.adjective}} culinary adventures',
'Stylish {{commerce.product}} designed to make you stand out with {{word.adjective}} looks',
'The sleek and {{word.adjective}} {{commerce.product}} comes with {{color.human}} LED lighting for smart functionality',
'The {{color.human}} {{commerce.product}} combines {{location.country}} aesthetics with {{science.chemical_element.name}}-based durability',
'The {{company.catchPhrase}} {{commerce.product}} offers reliable performance and {{word.adjective}} design',
'The {{person.firstName}} {{commerce.product}} is the latest in a series of {{word.adjective}} products from {{company.name}}',
'{{commerce.productAdjective}} {{commerce.product}} designed with {{commerce.productMaterial}} for {{word.adjective}} performance',
"{{company.name}}'s most advanced {{commerce.product}} technology increases {{word.adjective}} capabilities",
];
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`] = `"New salmon Pants with ergonomic design for crushing comfort"`;

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`] = `"Small Cheese designed with Wooden for right performance"`;

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`] = `"Innovative Car featuring lawful technology and Fresh construction"`;

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 ba4ef9a

Please sign in to comment.