feat(medusa, medusa-js, medusa-react): Implement Sales Channel update (#1797)

This commit is contained in:
Philip Korsholm
2022-07-06 15:44:09 +02:00
committed by GitHub
parent 263a661031
commit 9d19cc0818
19 changed files with 395 additions and 89 deletions
@@ -0,0 +1,33 @@
import { useAdminUpdateSalesChannel } from "../../../../src"
import { renderHook } from "@testing-library/react-hooks"
import { fixtures } from "../../../../mocks/data"
import { createWrapper } from "../../../utils"
describe("useAdminUpdateStore hook", () => {
test("updates a store", async () => {
const salesChannel = {
name: "medusa sales channel",
description: "main sales channel for medusa",
is_disabled: true,
}
const salesChannelId = fixtures.get("sales_channel").id
const { result, waitFor } = renderHook(
() => useAdminUpdateSalesChannel(salesChannelId),
{
wrapper: createWrapper(),
}
)
result.current.mutate(salesChannel)
await waitFor(() => result.current.isSuccess)
expect(result.current.data.response.status).toEqual(200)
expect(result.current.data.sales_channel).toEqual({
...fixtures.get("sales_channel"),
...salesChannel,
})
})
})
@@ -1,6 +1,4 @@
import {
useAdminSalesChannel,
} from "../../../../src"
import { useAdminSalesChannel } from "../../../../src"
import { renderHook } from "@testing-library/react-hooks"
import { fixtures } from "../../../../mocks/data"
import { createWrapper } from "../../../utils"