chore(core-flows, medusa): cancel request return (#8153)

* fix(core-flow): request item return reason

* chore(core-flows): cancel request return
This commit is contained in:
Carlos R. L. Rodrigues
2024-07-17 09:35:46 +01:00
committed by GitHub
parent d4fe2daa57
commit 1acfdc4ffe
23 changed files with 263 additions and 28 deletions
@@ -531,6 +531,53 @@ medusaIntegrationTestRunner({
})
)
})
it("should cancel a return request", async () => {
let result = await api.post(
"/admin/returns",
{
order_id: order.id,
description: "Test",
},
adminHeaders
)
const returnId = result.data.return.id
const item = order.items[0]
await api.post(
`/admin/returns/${returnId}/request-items`,
{
items: [
{
id: item.id,
quantity: 2,
reason_id: returnReason.id,
},
],
},
adminHeaders
)
await api.post(
`/admin/returns/${returnId}/shipping-method`,
{
shipping_option_id: returnShippingOption.id,
},
adminHeaders
)
await api.delete(`/admin/returns/${returnId}/request`, adminHeaders)
result = await api
.post(`/admin/returns/${returnId}/request`, {}, adminHeaders)
.catch((e) => e)
expect(result.response.status).toEqual(404)
expect(result.response.data.message).toEqual(
`Return id not found: ${returnId}`
)
})
})
},
})
@@ -778,8 +778,7 @@ medusaIntegrationTestRunner({
action: "use-remote-query",
handlerType: "invoke",
error: expect.objectContaining({
// TODO: Implement error message handler for Remote Query throw_if_key_not_found
message: `productService id not found: prva_foo`,
message: `ProductVariant id not found: prva_foo`,
}),
},
])
@@ -71,7 +71,7 @@ medusaIntegrationTestRunner({
)
await expect(getNonExistingRegion).rejects.toThrow(
"region id not found: region_123"
"Region id not found: region_123"
)
})
@@ -120,7 +120,7 @@ medusaIntegrationTestRunner({
})
expect(error.error.message).toEqual(
"order id not found: does-not-exist"
"Return id not found: does-not-exist"
)
})
@@ -145,7 +145,7 @@ medusaIntegrationTestRunner({
throwOnError: false,
})
expect(error.error.message).toEqual(`order id not found: ${order.id}`)
expect(error.error.message).toEqual(`Order id not found: ${order.id}`)
})
it("should throw an error if order change does not exist", async () => {
@@ -206,7 +206,7 @@ medusaIntegrationTestRunner({
})
expect(error.error.message).toEqual(
`Order Change cannot be modified: ${orderChange.id}.`
`An active Order Change is required to proceed`
)
})