feat(core-flows, product): options checks on product create/update (#9171)
**What** - validate that variants are unique with respect to options on product update/create and variant update/create - validate that the product has options upon creation - ensure variants have the same number of option values as the product has options - admin error handling - update tests --- FIXES FRMW-2707 CC-556
This commit is contained in:
@@ -35,9 +35,11 @@ medusaIntegrationTestRunner({
|
||||
"/admin/products",
|
||||
{
|
||||
title: "product 1",
|
||||
options: [{ title: "size", values: ["x", "l"] }],
|
||||
variants: [
|
||||
{
|
||||
title: "variant 1",
|
||||
options: { size: "x" },
|
||||
prices: [{ currency_code: "usd", amount: 100 }],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -40,7 +40,12 @@ medusaIntegrationTestRunner({
|
||||
|
||||
const { errors } = await workflow.run({
|
||||
input: {
|
||||
create: [{ title: "test3" }],
|
||||
create: [
|
||||
{
|
||||
title: "test3",
|
||||
options: [{ title: "size", options: ["x"] }],
|
||||
},
|
||||
],
|
||||
update: [{ id: product1.id, title: "test1-updated" }],
|
||||
delete: [product2.id],
|
||||
},
|
||||
@@ -88,14 +93,17 @@ medusaIntegrationTestRunner({
|
||||
create: [
|
||||
{
|
||||
title: "test1",
|
||||
options: [{ title: "size", values: ["x", "l", "m"] }],
|
||||
variants: [
|
||||
{
|
||||
title: "variant1",
|
||||
prices: [{ amount: 100, currency_code: "EUR" }],
|
||||
options: { size: "x" },
|
||||
},
|
||||
{
|
||||
title: "variant2",
|
||||
prices: [{ amount: 100, currency_code: "EUR" }],
|
||||
options: { size: "l" },
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -110,6 +118,7 @@ medusaIntegrationTestRunner({
|
||||
{
|
||||
title: "variant3",
|
||||
product_id: product1.id,
|
||||
options: { size: "m" },
|
||||
prices: [{ amount: 100, currency_code: "EUR" }],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user