feat(medusa, medusa-js, medusa-react): Implement Sales Channel update (#1797)
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user