feat(medusa, medusa-js, medusa-react): Start implementing remove batch products on a sales channel (#1842)
What Support sales channel remove product batch in medusa, medusa-js and medusa-react How By implementing a new endpoint and the associated service method as well as the repository methods. Medusa-js new removeProductd method in the resource Medusa-react new hook in the mutations Tests Endpoint test Service test Integration test Hook tests Fixes CORE-292
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
useAdminDeleteSalesChannel,
|
||||
useAdminCreateSalesChannel,
|
||||
useAdminUpdateSalesChannel,
|
||||
useAdminDeleteProductsFromSalesChannel,
|
||||
} from "../../../../src"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
@@ -84,3 +85,25 @@ describe("useAdminDeleteSalesChannel hook", () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("useAdminDeleteProductsFromSalesChannel hook", () => {
|
||||
test("remove products from a sales channel", async () => {
|
||||
const id = fixtures.get("sales_channel").id
|
||||
const productId = fixtures.get("product").id
|
||||
|
||||
const { result, waitFor } = renderHook(
|
||||
() => useAdminDeleteProductsFromSalesChannel(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