feat(medusa): Support batch remove resources on discount condition (#2444)

**what**
- Add support to remove resources by batch on discount conditions
- Add support on medusa-js and medusa-react

**Tests**
- Add integration tests to validate that the resources have been deleted and the length is the one expected
- Add unit tests on medusa react

FIXES CORE-609
This commit is contained in:
Adrien de Peretti
2022-10-17 09:03:38 +00:00
committed by GitHub
parent 765a2cccda
commit 48411157b1
12 changed files with 432 additions and 12 deletions
@@ -939,6 +939,29 @@ export const adminHandlers = [
}
),
rest.delete(
"/admin/discounts/:id/conditions/:conditionId/batch",
(req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
discount: {
...fixtures.get("discount"),
rule: {
...fixtures.get("discount").rule,
conditions: [
{
...fixtures.get("discount").rule.conditions[0],
products: [],
},
],
},
},
})
)
}
),
rest.get("/admin/draft-orders/", (req, res, ctx) => {
return res(
ctx.status(200),