fix(medeusa): Transform query includes options should only be added to allowed props if there is already at least one allowed props (#3362)

**What**
when `fields` only contain includes options, it should return the entire object plus the include options. If the fields contains the included options + other fields, it should only return the requested fields + the included options
This commit is contained in:
Adrien de Peretti
2023-03-07 11:52:14 +00:00
committed by GitHub
parent 15f47baf56
commit 33c6ccf059
6 changed files with 160 additions and 83 deletions
@@ -301,7 +301,7 @@ describe("/admin/swaps", () => {
// ********* CREATE SWAP *********
const createSwap = await api.post(
`/admin/orders/${completedOrder.data.data.id}/swaps?fields=returnable_items`,
`/admin/orders/${completedOrder.data.data.id}/swaps`,
{
return_items: [
{
@@ -318,13 +318,6 @@ describe("/admin/swaps", () => {
}
)
expect(createSwap.data.order.returnable_items).toHaveLength(1)
expect(createSwap.data.order.returnable_items[0]).toEqual(
expect.objectContaining({
id: "line-item",
})
)
let swap = createSwap.data.order.swaps[0]
// ********* PREPARE SWAP CART *********