Skip to content

Commit

Permalink
products - updated with better description
Browse files Browse the repository at this point in the history
  • Loading branch information
brianvoe committed Oct 26, 2024
1 parent 577cd74 commit 59e0c2a
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 29 deletions.
73 changes: 73 additions & 0 deletions data/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,77 @@ var Product = map[string][]string{
"small", "medium", "large", "extra-large", "compact", "lightweight",
"heavy", "mini", "standard", "oversized",
},

"description": {
"This {adjectivedescriptive} {productname} is perfect for {productusecase}, offering {productfeature} and {productbenefit}. Made from {productmaterial}, it's designed for {productaudience} who value {productbenefit}.",
"Introducing the {adjectivedescriptive} {productname} {productsuffix}, featuring {productfeature} technology and made from {productmaterial}. It ensures {productbenefit} for {productaudience}, making it ideal for {productusecase}.",
"Perfect for {productusecase}, the {productname} is crafted with {adjectivedescriptive} {productmaterial} and features {productfeature} for {productaudience}. Enjoy {productbenefit} every day.",
"Designed with {productaudience} in mind, this {adjectivedescriptive} {productname} offers {productbenefit}. It's equipped with {productfeature} and made from {productmaterial} for maximum {productbenefit}.",
"The {productname} {productsuffix} combines {adjectivedescriptive} design and {productmaterial} build to deliver {productfeature}. Its {productdimension} size makes it perfect for {productusecase} and ideal for {productaudience}.",
"With a focus on {productaudience}, the {productname} is built with {adjectivedescriptive} {productmaterial} for {productbenefit} and features {productfeature} to meet the needs of {productusecase}.",
"Experience the {productbenefit} of the {productname} {productsuffix}, made from {productmaterial} with a {adjectivedescriptive} design. It's ideal for {productusecase} and loved by {productaudience}.",
"Whether you're using it at {productusecase} or on the go, this {adjectivedescriptive} {productname} offers {productfeature} and ensures {productbenefit}. Crafted from {productmaterial}, it's perfect for {productaudience}.",
"The {productname} is a {adjectivedescriptive} solution for {productusecase}, featuring {productfeature} technology and built with {productmaterial} for {productbenefit}. Suitable for {productaudience}.",
"For {productaudience} who need {productbenefit}, the {productname} {productsuffix} delivers with {productfeature}, {adjectivedescriptive} design, and durable {productmaterial} construction. Ideal for {productusecase}.",
"Built with {adjectivedescriptive} {productmaterial}, this item is ideal for {productusecase} and provides {productaudience} with {productbenefit} through its {productfeature}.",
"Experience {productbenefit} with this {adjectivedescriptive} product, featuring {productfeature} and made from {productmaterial}, perfect for {productusecase}.",
"Designed for {productaudience}, this {adjectivedescriptive} product ensures {productbenefit} and is equipped with {productfeature} for the best {productusecase} experience.",
"For those who need {productbenefit}, this {adjectivedescriptive} product, made of {productmaterial}, offers {productfeature} and is perfect for {productusecase}.",
"Take your {productusecase} to the next level with this {adjectivedescriptive} product. Built from {productmaterial}, it features {productfeature} for {productaudience}.",
"Crafted from {productmaterial}, this product is ideal for {productaudience} seeking {productbenefit}. Its {adjectivedescriptive} design and {productfeature} make it perfect for {productusecase}.",
"This product, made with {productmaterial}, is designed for {productaudience} who value {productbenefit}. Its {adjectivedescriptive} design includes {productfeature}, making it ideal for {productusecase}.",
"Enjoy {productbenefit} with this {adjectivedescriptive} item, featuring {productfeature} technology. Made from {productmaterial}, it's perfect for {productusecase}.",
"With {productfeature} and {adjectivedescriptive} {productmaterial}, this product offers {productbenefit} for {productaudience}, ideal for {productusecase}.",
"The perfect solution for {productusecase}, this {adjectivedescriptive} product provides {productbenefit} with its {productfeature}, crafted from {productmaterial} for {productaudience}.",
"Built for {productaudience}, this product features {productfeature} and ensures {productbenefit}. Made from {productmaterial}, it's an {adjectivedescriptive} choice for {productusecase}.",
"Achieve {productbenefit} with this {adjectivedescriptive} product. Crafted from {productmaterial}, it features {productfeature}, perfect for {productaudience} during {productusecase}.",
"For {productaudience}, this {adjectivedescriptive} item offers {productfeature} and is made of {productmaterial}, providing {productbenefit} for {productusecase}.",
"This {adjectivedescriptive} product is crafted from {productmaterial} and includes {productfeature}, making it perfect for {productusecase} and delivering {productbenefit} for {productaudience}.",
"Featuring {productfeature} and made from {productmaterial}, this {adjectivedescriptive} product is ideal for {productaudience} looking for {productbenefit} in {productusecase}.",
"For {productusecase}, this {adjectivedescriptive} product provides {productbenefit} with its {productfeature}, crafted for {productaudience} from high-quality {productmaterial}.",
"This {adjectivedescriptive} product is perfect for {productaudience} who need {productbenefit}. Built from {productmaterial} and featuring {productfeature}, it's ideal for {productusecase}.",
"Delivering {productbenefit}, this product is made from {productmaterial} and designed for {productaudience}. Its {adjectivedescriptive} design includes {productfeature}, perfect for {productusecase}.",
"For those interested in {productusecase}, this {adjectivedescriptive} product offers {productfeature} and is made of {productmaterial} to provide {productbenefit} for {productaudience}.",
"This product is crafted for {productaudience}, featuring {adjectivedescriptive} {productmaterial} and equipped with {productfeature} to ensure {productbenefit} during {productusecase}.",
"Transform your {productusecase} with this {adjectivedescriptive} product, featuring {productfeature} and made from high-quality {productmaterial} to provide {productbenefit}.",
"This {adjectivedescriptive} item, built for {productaudience}, uses {productfeature} technology to deliver {productbenefit} during {productusecase}.",
"Enjoy the luxury of {productbenefit} with this product, crafted from {productmaterial}. Its {adjectivedescriptive} design and {productfeature} make it ideal for {productusecase}.",
"Made from {productmaterial} and designed with {productaudience} in mind, this product offers {productbenefit} and features {productfeature} for excellent {productusecase}.",
"Achieve seamless {productusecase} with this {adjectivedescriptive} product. Built using {productmaterial}, it delivers {productbenefit} with the help of {productfeature}.",
"This product, made for {productaudience}, offers {productbenefit} with its {adjectivedescriptive} {productmaterial} build and advanced {productfeature}, perfect for {productusecase}.",
"Built with {productmaterial}, this {adjectivedescriptive} product is designed to provide {productbenefit} for {productaudience} through its {productfeature}, ideal for {productusecase}.",
"Elevate your {productusecase} experience with this {adjectivedescriptive} product, made from {productmaterial} and offering {productfeature} to ensure {productbenefit}.",
"Perfect for {productaudience} who value {productbenefit}, this product features {productfeature} and is crafted from {adjectivedescriptive} {productmaterial}, ideal for {productusecase}.",
"With a focus on {productusecase}, this {adjectivedescriptive} product, made from {productmaterial}, ensures {productbenefit} with its {productfeature} for {productaudience}.",
"Whether for {productusecase} or everyday use, this product delivers {productbenefit} with its {adjectivedescriptive} {productmaterial} construction and {productfeature}, crafted for {productaudience}.",
"This {adjectivedescriptive} product is perfect for {productusecase}, made with {productmaterial} and offering {productfeature} to ensure {productbenefit} for {productaudience}.",
"Featuring state-of-the-art {productfeature}, this product is designed from {productmaterial} to deliver {productbenefit} for {productaudience}, ideal for {productusecase}.",
"For {productusecase}, this {adjectivedescriptive} product is crafted from {productmaterial} to provide {productfeature}, ensuring {productbenefit} for {productaudience}.",
"Built for {productaudience}, this item features {adjectivedescriptive} {productmaterial} and advanced {productfeature} to deliver {productbenefit} during {productusecase}.",
"With {productfeature} and a {adjectivedescriptive} design, this product is made from {productmaterial} to provide {productbenefit} for {productaudience}, ideal for {productusecase}.",
"This {adjectivedescriptive} item, crafted from {productmaterial}, offers {productfeature} for {productusecase}, ensuring {productbenefit} for {productaudience}.",
"For those who value {productbenefit}, this product, made from {productmaterial}, includes {productfeature} and is perfect for {productusecase}, designed for {productaudience}.",
"Achieve superior {productusecase} with this product, featuring {productfeature} and made from {adjectivedescriptive} {productmaterial}, offering {productbenefit} to {productaudience}.",
"Delivering {productbenefit}, this product is crafted from {productmaterial} and equipped with {productfeature}, making it ideal for {productaudience} during {productusecase}.",
"Revolutionize your {productusecase} with this {adjectivedescriptive} item, featuring {productfeature} and crafted from {productmaterial} for {productaudience} seeking {productbenefit}.",
"This {adjectivedescriptive} item, designed for {productaudience}, is built from {productmaterial} and includes {productfeature} to ensure {productbenefit} for {productusecase}.",
"Enjoy enhanced {productusecase} with this product, featuring {productfeature} and made with {adjectivedescriptive} {productmaterial}, delivering {productbenefit}.",
"Perfect for {productaudience}, this {adjectivedescriptive} product includes {productfeature} and is crafted from {productmaterial} to provide {productbenefit} during {productusecase}.",
"Take your {productusecase} to new heights with this product, made from {productmaterial} and featuring {productfeature} for {productaudience} who value {productbenefit}.",
"Crafted from premium {productmaterial}, this item is designed for {productaudience} to provide {productbenefit} with its {adjectivedescriptive} build and {productfeature}.",
"This {adjectivedescriptive} product, made from {productmaterial}, offers {productbenefit} through its {productfeature}, ideal for {productaudience} engaging in {productusecase}.",
"Elevate your {productusecase} with this {adjectivedescriptive} product. It features {productfeature} and is crafted from {productmaterial} for {productaudience}.",
"Designed for {productaudience}, this product includes {productfeature} and a {adjectivedescriptive} {productmaterial} construction, ensuring {productbenefit} during {productusecase}.",
"This {adjectivedescriptive} item, featuring {productfeature}, is crafted from {productmaterial} to provide {productbenefit} for {productusecase}, perfect for {productaudience}.",
"Achieve exceptional {productusecase} with this product, featuring advanced {productfeature} and made from durable {productmaterial}, delivering {productbenefit} for {productaudience}.",
"Whether it's for {productusecase} or daily use, this {adjectivedescriptive} item is crafted from {productmaterial} and offers {productfeature} to deliver {productbenefit} for {productaudience}.",
"This product, ideal for {productaudience}, features {adjectivedescriptive} {productmaterial} and incorporates {productfeature} to ensure {productbenefit} during {productusecase}.",
"Built with {productmaterial}, this {adjectivedescriptive} item is perfect for {productusecase} and features {productfeature} to provide {productbenefit} to {productaudience}.",
"With {productfeature} and made from {adjectivedescriptive} {productmaterial}, this product ensures {productbenefit} for {productaudience}, ideal for {productusecase}.",
"This {adjectivedescriptive} item is built for {productaudience}, providing {productbenefit} with its {productmaterial} construction and advanced {productfeature}, perfect for {productusecase}.",
"For {productusecase}, this product delivers {productbenefit} to {productaudience} with its {adjectivedescriptive} design and {productfeature}, made from quality {productmaterial}.",
"Experience the benefits of {productfeature} with this {adjectivedescriptive} item, crafted from {productmaterial} and ideal for {productaudience} seeking {productbenefit} during {productusecase}.",
"This {adjectivedescriptive} product is crafted from {productmaterial} and includes {productfeature}, making it perfect for {productusecase} and providing {productbenefit} for {productaudience}.",
"For those who value {productbenefit}, this product is made from {productmaterial} and features {adjectivedescriptive} {productfeature}, ideal for {productaudience} during {productusecase}.",
},
}
9 changes: 2 additions & 7 deletions product.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package gofakeit

import (
"fmt"
"strings"
)

type ProductInfo struct {
Expand Down Expand Up @@ -110,12 +109,8 @@ func ProductDescription() string { return productDescription(GlobalFaker) }
func (f *Faker) ProductDescription() string { return productDescription(f) }

func productDescription(f *Faker) string {
desc := []string{}
for i := 0; i < number(f, 1, 3); i++ {
desc = append(desc, sentence(f, number(f, 5, 15)))
}

return strings.Join(desc, " ")
desc, _ := generate(f, getRandValue(f, []string{"product", "description"}))
return desc
}

// ProductCategory will generate a random product category
Expand Down
55 changes: 33 additions & 22 deletions product_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gofakeit

import (
"fmt"
"strings"
"testing"
)

Expand All @@ -23,18 +24,18 @@ func ExampleProduct() {
fmt.Println(product.Suffix)

// Output: Wave Precision Lamp
// Since previously was that there a tennis occur why. Heels out can fire anyone sometimes. Leap whom troop now scarcely.
// This grieving product is crafted from rubber and includes ultra-lightweight, making it perfect for professional work and delivering improved productivity for [athletes].
// [cosmetics outdoor gear]
// 49.18
// 32.91
// [touchscreen ultra-lightweight gps-enabled biometric]
// green
// brass
// 082447816155
// [seniors]
// compact
// learning
// minimal maintenance
// dash
// blue
// felt
// 009410268940
// [pet owners gamers]
// oversized
// office
// customizability
// nexus
}

func ExampleFaker_Product() {
Expand All @@ -55,18 +56,18 @@ func ExampleFaker_Product() {
fmt.Println(product.Suffix)

// Output: Wave Precision Lamp
// Since previously was that there a tennis occur why. Heels out can fire anyone sometimes. Leap whom troop now scarcely.
// This grieving product is crafted from rubber and includes ultra-lightweight, making it perfect for professional work and delivering improved productivity for [athletes].
// [cosmetics outdoor gear]
// 49.18
// 32.91
// [touchscreen ultra-lightweight gps-enabled biometric]
// green
// brass
// 082447816155
// [seniors]
// compact
// learning
// minimal maintenance
// dash
// blue
// felt
// 009410268940
// [pet owners gamers]
// oversized
// office
// customizability
// nexus
}

func TestProduct(t *testing.T) {
Expand Down Expand Up @@ -156,14 +157,24 @@ func ExampleProductDescription() {
Seed(11)
fmt.Println(ProductDescription())

// Output: Regularly quiver these sprint fight something am elsewhere since previously was that there a. Occur why depend heels out can fire anyone sometimes that leap whom troop now.
// Output: This product, ideal for [seniors families], features puzzled gold and incorporates gps-enabled to ensure robust construction during remote work.
}

func ExampleFaker_ProductDescription() {
f := New(11)
fmt.Println(f.ProductDescription())

// Output: Regularly quiver these sprint fight something am elsewhere since previously was that there a. Occur why depend heels out can fire anyone sometimes that leap whom troop now.
// Output: This product, ideal for [seniors families], features puzzled gold and incorporates gps-enabled to ensure robust construction during remote work.
}

// Runs 10,000 tests to ensure description doesnt have any { or } in it
func TestProductDescriptionReplacement(t *testing.T) {
for i := 0; i < 100000; i++ {
desc := ProductDescription()
if strings.ContainsAny(desc, "{") || strings.ContainsAny(desc, "}") {
t.Error("Description contains { or }")
}
}
}

func BenchmarkProductDescription(b *testing.B) {
Expand Down

0 comments on commit 59e0c2a

Please sign in to comment.