Files
medusa-store/packages/medusa-react/test/hooks/admin/order-edits/queries.test.ts
Adrien de Peretti f863d28b9a feat(medusa): Implement premises of order edit retrieval (#2183)
**What**
- Implements the admin/store retrieval end point 
- Service implementation of the retrieve method
- Service implementation of the computeLineItems method which aggregates the right line item based on the changes that are made
- client
  - medusa-js api
  - medusa-react queries hooks

**Tests**
- Unit tests of the retrieval end points
- Unit tests of the service retrieve method and computeLineItems
- Integration tests for admin/store
- client
  - medusa-js tests
  - medusa-react hooks tests

FIXES CORE-492
2022-09-15 09:12:20 +00:00

22 lines
667 B
TypeScript

import { fixtures } from "../../../../mocks/data"
import { renderHook } from "@testing-library/react-hooks"
import { useAdminOrderEdit } from "../../../../src"
import { createWrapper } from "../../../utils"
describe("useAdminOrderEdit hook", () => {
test("returns an order edit", async () => {
const order_edit = fixtures.get("order_edit")
const { result, waitFor } = renderHook(
() => useAdminOrderEdit(order_edit.id),
{
wrapper: createWrapper(),
}
)
await waitFor(() => result.current.isSuccess)
expect(result.current.response.status).toEqual(200)
expect(result.current.order_edit).toEqual(order_edit)
})
})