feat(medusa, medusa-js, medusa-react): Bulk add Products to a SalesChannel (#1833)
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
useAdminCreateSalesChannel,
|
||||
useAdminUpdateSalesChannel,
|
||||
useAdminDeleteProductsFromSalesChannel,
|
||||
useAdminAddProductsToSalesChannel,
|
||||
} from "../../../../src"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
@@ -107,3 +108,25 @@ describe("useAdminDeleteProductsFromSalesChannel hook", () => {
|
||||
}))
|
||||
})
|
||||
})
|
||||
|
||||
describe("useAdminAddProductsToSalesChannel hook", () => {
|
||||
test("add products to a sales channel", async () => {
|
||||
const id = fixtures.get("sales_channel").id
|
||||
const productId = fixtures.get("product").id
|
||||
|
||||
const { result, waitFor } = renderHook(
|
||||
() => useAdminAddProductsToSalesChannel(id),
|
||||
{ wrapper: createWrapper() }
|
||||
)
|
||||
|
||||
result.current.mutate({ product_ids: [
|
||||
{ id: productId }
|
||||
]})
|
||||
|
||||
await waitFor(() => result.current.isSuccess)
|
||||
|
||||
expect(result.current.data).toEqual(expect.objectContaining({
|
||||
sales_channel: fixtures.get("sales_channel"),
|
||||
}))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user