feat(medusa): Update OrderEdit (#2220)
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
|
||||
import {
|
||||
useAdminCreateOrderEdit,
|
||||
useAdminUpdateOrderEdit,
|
||||
useAdminDeleteOrderEdit,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { createWrapper } from "../../../utils"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminDelete hook", () => {
|
||||
test("Deletes an order edit", async () => {
|
||||
@@ -27,6 +30,33 @@ describe("useAdminDelete hook", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("useAdminUpdateOrderEdit hook", () => {
|
||||
test("updates an order edit and returns it", async () => {
|
||||
const orderEdit = {
|
||||
internal_note: "changed note",
|
||||
}
|
||||
|
||||
const { result, waitFor } = renderHook(
|
||||
() => useAdminUpdateOrderEdit(fixtures.get("order_edit").id),
|
||||
{
|
||||
wrapper: createWrapper(),
|
||||
}
|
||||
)
|
||||
|
||||
result.current.mutate(orderEdit)
|
||||
|
||||
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"),
|
||||
...orderEdit,
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("useAdminCreateOrderEdit hook", () => {
|
||||
test("Created an order edit", async () => {
|
||||
const { result, waitFor } = renderHook(() => useAdminCreateOrderEdit(), {
|
||||
|
||||
Reference in New Issue
Block a user