fix(medusa): Allow filtering by handle and title as arrays (#11472)

**What**
- Allows filtering products in the Store API with an array value for both `handle` and `title`.

RESOLVES SUP-893
This commit is contained in:
Kasper Fabricius Kristensen authored and GitHub committed 2025-02-14 14:10:32 +00:00
1 parent 9f39cd19f8
commit 825b8ad260
3 files changed
+35 -2

No files matched your search

@@ -862,6 +862,34 @@ medusaIntegrationTestRunner({
])
})
it("returns a list of products with one of the given handles", async () => {
const response = await api.get(
`/store/products?handle[]=${product.handle}&handle[]=${product2.handle}`,
storeHeaders
)
expect(response.status).toEqual(200)
expect(response.data.count).toEqual(2)
expect(response.data.products).toEqual([
expect.objectContaining({ id: product.id }),
expect.objectContaining({ id: product2.id }),
])
})
it("returns a list of products with one of the given titles", async () => {
const response = await api.get(
`/store/products?title[]=${product.title}&title[]=${product2.title}`,
storeHeaders
)
expect(response.status).toEqual(200)
expect(response.data.count).toEqual(2)
expect(response.data.products).toEqual([
expect.objectContaining({ id: product.id }),
expect.objectContaining({ id: product2.id }),
])
})
// TODO: Not implemented yet
it.skip("returns gift card product", async () => {
const response = await api