Feat(medusa): cancel order edit (#2240)
**What** - cancel an order edit Fixes CORE-500
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
useAdminDeleteOrderEditItemChange,
|
||||
useAdminUpdateOrderEdit,
|
||||
useAdminRequestOrderEditConfirmation,
|
||||
useAdminCancelOrderEdit,
|
||||
} from "../../../../src/"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
@@ -129,3 +130,27 @@ describe("useAdminRequestOrderEditConfirmation hook", () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("useAdminCancelOrderEdit hook", () => {
|
||||
test("cancel an order edit", async () => {
|
||||
|
||||
const { result, waitFor } = renderHook(() => useAdminCancelOrderEdit(fixtures.get("order_edit").id), {
|
||||
wrapper: createWrapper(),
|
||||
})
|
||||
|
||||
result.current.mutate()
|
||||
|
||||
await waitFor(() => result.current.isSuccess)
|
||||
|
||||
expect(result.current.data.response.status).toEqual(200)
|
||||
expect(result.current.data).toEqual(
|
||||
expect.objectContaining({
|
||||
order_edit: {
|
||||
...fixtures.get("order_edit"),
|
||||
canceled_at: expect.any(String),
|
||||
status: 'canceled'
|
||||
},
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user