From 90d774f5636b28b0dc6a5d73eed020788544b20e Mon Sep 17 00:00:00 2001 From: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com> Date: Thu, 29 Dec 2022 18:15:10 +0100 Subject: [PATCH] tests(integration): Randomize option value name (#2918) --- .../api/factories/simple-product-variant-factory.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integration-tests/api/factories/simple-product-variant-factory.ts b/integration-tests/api/factories/simple-product-variant-factory.ts index 7c008519e36a4..f203ed7516c2c 100644 --- a/integration-tests/api/factories/simple-product-variant-factory.ts +++ b/integration-tests/api/factories/simple-product-variant-factory.ts @@ -14,7 +14,7 @@ export type ProductVariantFactoryData = { inventory_quantity?: number title?: string options?: { option_id: string; value: string }[] - prices?: { currency: string; amount: number, region_id?: string }[] + prices?: { currency: string; amount: number; region_id?: string }[] } export const simpleProductVariantFactory = async ( @@ -32,7 +32,7 @@ export const simpleProductVariantFactory = async ( const toSave = manager.create(ProductVariant, { id, product_id: data.product_id, - sku: data.sku , + sku: data.sku, inventory_quantity: typeof data.inventory_quantity !== "undefined" ? data.inventory_quantity @@ -45,7 +45,7 @@ export const simpleProductVariantFactory = async ( const options = data.options || [{ option_id: "test-option", value: "Large" }] for (const o of options) { await manager.insert(ProductOptionValue, { - id: `${o.value}-${o.option_id}`, + id: `${variant.id}-${o.option_id ?? Math.random()}`, value: o.value, variant_id: id, option_id: o.option_id, @@ -59,7 +59,7 @@ export const simpleProductVariantFactory = async ( variant_id: id, currency_code: p.currency, amount: p.amount, - region_id: p.region_id , + region_id: p.region_id, }) }