Feat(medusa): request order edit (#2239)
**What** - Implement `admin/order-edits/:id/request` Fixes CORE-499
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
|
||||
import {
|
||||
useAdminCreateOrderEdit,
|
||||
useAdminDeleteOrderEdit,
|
||||
useAdminDeleteOrderEditItemChange,
|
||||
useAdminUpdateOrderEdit,
|
||||
useAdminRequestOrderEditConfirmation,
|
||||
} from "../../../../src/"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
@@ -108,3 +108,24 @@ describe("useAdminCreateOrderEdit hook", () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("useAdminRequestOrderEditConfirmation hook", () => {
|
||||
test("Requests an order edit", async () => {
|
||||
const { result, waitFor } = renderHook(() => useAdminRequestOrderEditConfirmation(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?.order_edit).toEqual(
|
||||
expect.objectContaining({
|
||||
...fixtures.get("order_edit"),
|
||||
requested_at: expect.any(String),
|
||||
status: 'requested'
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user