feat(admin-ui, medusa-js, medusa-react, medusa): Multiwarehousing UI (#3403)

* add "get-variant" endpoint

* import from a different place

* fix unit test

* add changeset

* inventory management for orders

* add changeset

* initial create-fulfillment

* add changeset

* type oas and admin

* Move inv. creation and listing from admin repo

* Fix location editing bug (CORE-1216)

* Fix default warehouse on inventory table view

* remove actions from each table line

* Use feature flag hook instead of context directly

* remove manage inventory action if inventory management is not enabled

* Address review comments

* fix queries made when inventorymodules are disabled

* variant form changes for feature enabled

* move exclamation icon into warning icon

* ensure queries are not run unless feature is enabled for create-fulfillment

---------

Co-authored-by: Philip Korsholm <philip.korsholm@hotmail.com>
Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
This commit is contained in:
Rares Stefan
2023-03-08 16:08:56 +01:00
committed by GitHub
co-authored by Philip Korsholm Philip Korsholm
parent 53eda215e0
commit 57d7728dd9
49 changed files with 3922 additions and 722 deletions
@@ -1,7 +1,8 @@
import { renderHook } from "@testing-library/react-hooks/dom"
import { fixtures } from "../../../../mocks/data"
import { useAdminVariants, useAdminVariantsInventory } from "../../../../src"
import { useAdminVariant, useAdminVariants, useAdminVariantsInventory } from "../../../../src"
import { createWrapper } from "../../../utils"
import { fixtures } from "../../../../mocks/data"
import { renderHook } from "@testing-library/react-hooks"
describe("useAdminVariants hook", () => {
test("returns a list of variants", async () => {
@@ -17,6 +18,20 @@ describe("useAdminVariants hook", () => {
})
})
describe("useAdminVariant hook", () => {
test("returns a variant", async () => {
const variant = fixtures.get("product_variant")
const { result, waitFor } = renderHook(() => useAdminVariant(variant.id), {
wrapper: createWrapper(),
})
await waitFor(() => result.current.isSuccess)
expect(result.current.response.status).toEqual(200)
expect(result.current.variant).toEqual(variant)
})
})
describe("useAdminVariants hook", () => {
test("returns a variant with saleschannel locations", async () => {
const variant = fixtures.get("product_variant")