fix(core-flows): conditionally create, update or delete products when input is present (#11758)

what:

- runs create / update /delete workflows for bulk workflow conditionally

FIXES https://github.com/medusajs/medusa/issues/11749
depends on https://github.com/medusajs/medusa/pull/11756
This commit is contained in:
Riqwan Thamir
2025-03-06 14:41:20 +01:00
committed by GitHub
parent 84f991192e
commit f00bb8efcf
2 changed files with 41 additions and 11 deletions

View File

@@ -3100,6 +3100,25 @@ medusaIntegrationTestRunner({
)
})
it("should successfully delete products", async () => {
const response = await api.post(
"/admin/products/batch",
{ delete: [baseProduct.id] },
adminHeaders
)
expect(response.status).toEqual(200)
expect(response.data.created).toHaveLength(0)
expect(response.data.updated).toHaveLength(0)
expect(response.data.deleted.ids).toHaveLength(1)
expect(response.data.created).toEqual([])
expect(response.data.updated).toEqual([])
expect(response.data.deleted).toEqual(
expect.objectContaining({ ids: [baseProduct.id] })
)
})
it("successfully creates, updates, and deletes product variants", async () => {
const productWithMultipleVariants = getProductFixture({
title: "Test batch variants",