feat(medusa-js, medusa-react): PublishableKeys SC management (#2734)
This commit is contained in:
@@ -3,6 +3,7 @@ import { renderHook } from "@testing-library/react-hooks"
|
||||
import {
|
||||
useAdminPublishableApiKey,
|
||||
useAdminPublishableApiKeys,
|
||||
useAdminPublishableApiKeySalesChannels,
|
||||
} from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
@@ -39,3 +40,23 @@ describe("useAdminPublishableApiKeys hook", () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("useAdminPublishableApiKeySalesChannels hook", () => {
|
||||
test("returns a list of sales channels of a publishable api key", async () => {
|
||||
const publishable_api_key = fixtures.get("publishable_api_key")
|
||||
|
||||
const { result, waitFor } = renderHook(
|
||||
() => useAdminPublishableApiKeySalesChannels(publishable_api_key.id),
|
||||
{
|
||||
wrapper: createWrapper(),
|
||||
}
|
||||
)
|
||||
|
||||
await waitFor(() => result.current.isSuccess)
|
||||
|
||||
expect(result.current.response.status).toEqual(200)
|
||||
expect(result.current.sales_channels).toEqual(
|
||||
fixtures.get("sales_channels")
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user