fix(product, utils): handle metadata key deletion on product update (#12478)

This commit is contained in:
Frane Polić authored and GitHub committed 2025-05-21 21:32:12 +02:00
1 parent 4e49cebcf0
commit c5a6573e26
5 files changed
+18 -54

No files matched your search

@@ -1912,7 +1912,7 @@ medusaIntegrationTestRunner({
const payload = {
metadata: {
"test-key": "",
"test-key": "", // item is deleted by setting to empty string
"test-key-2": null,
},
}
@@ -1924,13 +1924,11 @@ medusaIntegrationTestRunner({
)
expect(response.status).toEqual(200)
expect(response.data.product.metadata).toEqual(
// BREAKING: Metadata updates are all-or-nothing in v2
{
"test-key": "",
"test-key-2": null,
}
)
expect(response.data.product.metadata).toEqual({
// "test-key" is deleted
"test-key-2": null, // updated
"test-key-3": "test-value-3", // preserved
})
})
it("updates products sales channels", async () => {