Feat/decline order edit (#2234)

**What**
- Decline an order edit from a store endpoint
- Refactor totals setting to a service method

Fixes CORE-502
This commit is contained in:
Philip Korsholm
2022-09-21 11:02:10 +00:00
committed by GitHub
parent de85a971c6
commit c661cc789b
17 changed files with 486 additions and 67 deletions
@@ -0,0 +1,30 @@
import { useDeclineOrderEdit } from "../../../../src/"
import { renderHook } from "@testing-library/react-hooks"
import { createWrapper } from "../../../utils"
describe("useCreateLineItem hook", () => {
test("creates a line item", async () => {
const declineBody = {
declined_reason: "Wrong color",
}
const { result, waitFor } = renderHook(
() => useDeclineOrderEdit("test-cart"),
{
wrapper: createWrapper(),
}
)
result.current.mutate(declineBody)
await waitFor(() => result.current.isSuccess)
expect(result.current.data.response.status).toEqual(200)
expect(result.current.data.order_edit).toEqual(
expect.objectContaining({
status: "declined",
...declineBody,
})
)
})
})