feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)
This commit is contained in:
committed by
GitHub
parent
d6b1ad1ccd
commit
40de54b010
@@ -1,6 +1,6 @@
|
||||
import { useAdminDeleteSession, useAdminLogin } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminDeleteSession, useAdminLogin } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminLogin hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminGetSession } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminGetSession } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminGetSession hook", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCancelBatchJob,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminBatchJob, useAdminBatchJobs } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCancelClaim,
|
||||
useAdminCancelClaimFulfillment,
|
||||
useAdminCreateClaim,
|
||||
useAdminCancelClaim,
|
||||
useAdminUpdateClaim,
|
||||
useAdminFulfillClaim,
|
||||
useAdminCreateClaimShipment,
|
||||
useAdminFulfillClaim,
|
||||
useAdminUpdateClaim,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateClaim hook", () => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import {
|
||||
useAdminCreateCollection,
|
||||
useAdminUpdateCollection,
|
||||
useAdminDeleteCollection,
|
||||
useAdminAddProductsToCollection,
|
||||
useAdminRemoveProductsFromCollection,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminAddProductsToCollection,
|
||||
useAdminCreateCollection,
|
||||
useAdminDeleteCollection,
|
||||
useAdminRemoveProductsFromCollection,
|
||||
useAdminUpdateCollection,
|
||||
} from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateCollection hook", () => {
|
||||
@@ -90,7 +90,8 @@ describe("useAdminAddProductsToCollection hook", () => {
|
||||
}
|
||||
|
||||
const { result, waitFor } = renderHook(
|
||||
() => useAdminAddProductsToCollection(fixtures.get("product_collection").id),
|
||||
() =>
|
||||
useAdminAddProductsToCollection(fixtures.get("product_collection").id),
|
||||
{
|
||||
wrapper: createWrapper(),
|
||||
}
|
||||
@@ -116,7 +117,10 @@ describe("useAdminRemoveProductsFromCollection hook", () => {
|
||||
}
|
||||
|
||||
const { result, waitFor } = renderHook(
|
||||
() => useAdminRemoveProductsFromCollection(fixtures.get("product_collection").id),
|
||||
() =>
|
||||
useAdminRemoveProductsFromCollection(
|
||||
fixtures.get("product_collection").id
|
||||
),
|
||||
{
|
||||
wrapper: createWrapper(),
|
||||
}
|
||||
@@ -131,7 +135,7 @@ describe("useAdminRemoveProductsFromCollection hook", () => {
|
||||
expect.objectContaining({
|
||||
id: fixtures.get("product_collection").id,
|
||||
object: "product-collection",
|
||||
removed_products: remove.product_ids
|
||||
removed_products: remove.product_ids,
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminCollection, useAdminCollections } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminCollection, useAdminCollections } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCollections hook", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminUpdateCurrency } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminCurrencies } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateCustomerGroup,
|
||||
useAdminUpdateCustomerGroup,
|
||||
} from "../../../../src/"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateCustomerGroup hook", () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCustomerGroup,
|
||||
useAdminCustomerGroupCustomers,
|
||||
useAdminCustomerGroups,
|
||||
} from "../../../../src"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCustomerGroup hook", () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateCustomer,
|
||||
useAdminUpdateCustomer,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateCustomer hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminCustomer, useAdminCustomers } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminCustomer, useAdminCustomers } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCustomers hook", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DiscountConditionOperator } from "@medusajs/medusa"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminAddDiscountConditionResourceBatch,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminDiscount,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateDraftOrder,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminDraftOrder, useAdminDraftOrders } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminDraftOrder, useAdminDraftOrders } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminDraftOrders hook", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateGiftCard,
|
||||
useAdminUpdateGiftCard,
|
||||
useAdminDeleteGiftCard,
|
||||
useAdminUpdateGiftCard,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateGiftCard hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminGiftCard, useAdminGiftCards } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminGiftCard, useAdminGiftCards } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminGiftCards hook", () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import {
|
||||
useAdminUpdateInventoryItem,
|
||||
useAdminDeleteInventoryItem,
|
||||
useAdminUpdateLocationLevel,
|
||||
useAdminDeleteLocationLevel,
|
||||
useAdminCreateLocationLevel,
|
||||
useAdminDeleteInventoryItem,
|
||||
useAdminDeleteLocationLevel,
|
||||
useAdminUpdateInventoryItem,
|
||||
useAdminUpdateLocationLevel,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminUpdateInventoryItem hook", () => {
|
||||
@@ -71,7 +71,7 @@ describe("useAdminUpdateLocationLevel hook", () => {
|
||||
}
|
||||
)
|
||||
|
||||
result.current.mutate({ ...payload, stockLocationId: "location_id"})
|
||||
result.current.mutate({ ...payload, stockLocationId: "location_id" })
|
||||
|
||||
await waitFor(() => result.current.isSuccess)
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminInventoryItem,
|
||||
useAdminInventoryItemLocationLevels,
|
||||
useAdminInventoryItems,
|
||||
useAdminPriceList,
|
||||
useAdminPriceLists,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminInventoryItems hook", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import {
|
||||
useAdminAcceptInvite,
|
||||
useAdminCreateInvite,
|
||||
useAdminDeleteInvite,
|
||||
useAdminResendInvite,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminAcceptInvite hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminInvites } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminInvites } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminInvites hook", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateNote,
|
||||
useAdminUpdateNote,
|
||||
useAdminDeleteNote,
|
||||
useAdminUpdateNote,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateNote hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminNote, useAdminNotes } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminNote, useAdminNotes } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminNotes hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminResendNotification } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminResendNotification } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminResendNotification hook", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminNotifications } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCancelOrderEdit,
|
||||
useAdminConfirmOrderEdit,
|
||||
useAdminCreateOrderEdit,
|
||||
useAdminDeleteOrderEdit,
|
||||
useAdminDeleteOrderEditItemChange,
|
||||
useAdminOrderEditAddLineItem,
|
||||
useAdminOrderEditDeleteLineItem,
|
||||
useAdminOrderEditUpdateLineItem,
|
||||
useAdminRequestOrderEditConfirmation,
|
||||
useAdminOrderEditAddLineItem,
|
||||
useAdminUpdateOrderEdit,
|
||||
useAdminOrderEditDeleteLineItem,
|
||||
} from "../../../../src/"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminOrderEditUpdateLineItem hook", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { useAdminOrderEdit, useAdminOrderEdits } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminUpdateOrder,
|
||||
useAdminCompleteOrder,
|
||||
useAdminCapturePayment,
|
||||
useAdminRefundPayment,
|
||||
useAdminCreateShipment,
|
||||
useAdminCancelOrder,
|
||||
useAdminAddShippingMethod,
|
||||
useAdminArchiveOrder,
|
||||
useAdminCreateFulfillment,
|
||||
useAdminCancelFulfillment,
|
||||
useAdminCancelOrder,
|
||||
useAdminCapturePayment,
|
||||
useAdminCompleteOrder,
|
||||
useAdminCreateFulfillment,
|
||||
useAdminCreateShipment,
|
||||
useAdminRefundPayment,
|
||||
useAdminUpdateOrder,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminUpdateOrder hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminOrder, useAdminOrders } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminOrder, useAdminOrders } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminOrders hook", () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import {
|
||||
useAdminDeletePaymentCollection,
|
||||
useAdminUpdatePaymentCollection,
|
||||
useAdminMarkPaymentCollectionAsAuthorized,
|
||||
useAdminUpdatePaymentCollection,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminDeletePaymentCollection hook", () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
import { useAdminPaymentCollection } from "../../../../src/hooks/admin/payment-collections"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminPaymentCollection hook", () => {
|
||||
test("returns a payment collection", async () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { RefundReason } from "@medusajs/medusa"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import {
|
||||
useAdminPaymentsCapturePayment,
|
||||
useAdminPaymentsRefundPayment,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { createWrapper } from "../../../utils"
|
||||
import { RefundReason } from "@medusajs/medusa"
|
||||
|
||||
describe("useAdminPaymentsCapturePayment hook", () => {
|
||||
test("Capture a payment", async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
import { useAdminPayment } from "../../../../src/hooks/admin/payments"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminPayment hook", () => {
|
||||
test("returns a payment collection", async () => {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreatePriceList,
|
||||
useAdminCreatePriceListPrices,
|
||||
@@ -7,8 +9,6 @@ import {
|
||||
useAdminDeletePriceListVariantPrices,
|
||||
useAdminUpdatePriceList,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
import { PriceListType } from "@medusajs/medusa/dist/types/price-list"
|
||||
@@ -143,10 +143,11 @@ describe("useAdminDeletePriceList hook", () => {
|
||||
describe("useAdminDeletePriceListProductPrices hook", () => {
|
||||
test("should delete prices from a price list for all the variants related to the specified product", async () => {
|
||||
const { result, waitFor } = renderHook(
|
||||
() => useAdminDeletePriceListProductPrices(
|
||||
fixtures.get("price_list").id,
|
||||
fixtures.get("product").id
|
||||
),
|
||||
() =>
|
||||
useAdminDeletePriceListProductPrices(
|
||||
fixtures.get("price_list").id,
|
||||
fixtures.get("product").id
|
||||
),
|
||||
{
|
||||
wrapper: createWrapper(),
|
||||
}
|
||||
@@ -157,21 +158,24 @@ describe("useAdminDeletePriceListProductPrices hook", () => {
|
||||
await waitFor(() => result.current.isSuccess)
|
||||
|
||||
expect(result.current.data.response.status).toEqual(200)
|
||||
expect(result.current.data).toEqual(expect.objectContaining({
|
||||
ids: [],
|
||||
object: "money-amount",
|
||||
deleted: true
|
||||
}))
|
||||
expect(result.current.data).toEqual(
|
||||
expect.objectContaining({
|
||||
ids: [],
|
||||
object: "money-amount",
|
||||
deleted: true,
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("useAdminDeletePriceListVariantPrices hook", () => {
|
||||
test("should delete prices from a price list for the specified variant", async () => {
|
||||
const { result, waitFor } = renderHook(
|
||||
() => useAdminDeletePriceListVariantPrices(
|
||||
fixtures.get("price_list").id,
|
||||
fixtures.get("product_variant").id
|
||||
),
|
||||
() =>
|
||||
useAdminDeletePriceListVariantPrices(
|
||||
fixtures.get("price_list").id,
|
||||
fixtures.get("product_variant").id
|
||||
),
|
||||
{
|
||||
wrapper: createWrapper(),
|
||||
}
|
||||
@@ -182,10 +186,12 @@ describe("useAdminDeletePriceListVariantPrices hook", () => {
|
||||
await waitFor(() => result.current.isSuccess)
|
||||
|
||||
expect(result.current.data.response.status).toEqual(200)
|
||||
expect(result.current.data).toEqual(expect.objectContaining({
|
||||
ids: [],
|
||||
object: "money-amount",
|
||||
deleted: true
|
||||
}))
|
||||
expect(result.current.data).toEqual(
|
||||
expect.objectContaining({
|
||||
ids: [],
|
||||
object: "money-amount",
|
||||
deleted: true,
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminPriceList, useAdminPriceLists } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminPriceList, useAdminPriceLists } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminPriceLists hook", () => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminAddProductsToCategory,
|
||||
useAdminCreateProductCategory,
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
useAdminDeleteProductsFromCategory,
|
||||
useAdminUpdateProductCategory,
|
||||
} from "../../../../src"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateProductCategory hook", () => {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { useAdminProductCategory, useAdminProductCategories } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminProductCategories,
|
||||
useAdminProductCategory,
|
||||
} from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminProductCategories hook", () => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateProduct,
|
||||
useAdminUpdateProduct,
|
||||
useAdminDeleteProduct,
|
||||
useAdminCreateProductOption,
|
||||
useAdminDeleteProduct,
|
||||
useAdminDeleteProductOption,
|
||||
useAdminUpdateProduct,
|
||||
useAdminUpdateProductOption,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateProduct hook", () => {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminProduct,
|
||||
useAdminProducts,
|
||||
useAdminProductTagUsage,
|
||||
useAdminProductTypes,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminProducts hook", () => {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminAddPublishableKeySalesChannelsBatch,
|
||||
useAdminCreatePublishableApiKey,
|
||||
useAdminDeletePublishableApiKey,
|
||||
useAdminRemovePublishableKeySalesChannelsBatch,
|
||||
useAdminRevokePublishableApiKey,
|
||||
useAdminUpdatePublishableApiKey,
|
||||
useAdminCreatePublishableApiKey,
|
||||
useAdminAddPublishableKeySalesChannelsBatch,
|
||||
useAdminRemovePublishableKeySalesChannelsBatch,
|
||||
} from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
|
||||
describe("useAdminCreatePublishableApiKey hook", () => {
|
||||
test("Created a publishable api key", async () => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminPublishableApiKey,
|
||||
useAdminPublishableApiKeys,
|
||||
useAdminPublishableApiKeySalesChannels,
|
||||
} from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
|
||||
describe("useAdminPublishableApiKey hook", () => {
|
||||
test("returns an publishable api key", async () => {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateRegion,
|
||||
useAdminUpdateRegion,
|
||||
useAdminDeleteRegion,
|
||||
useAdminRegionAddFulfillmentProvider,
|
||||
useAdminRegionDeleteFulfillmentProvider,
|
||||
useAdminRegionAddPaymentProvider,
|
||||
useAdminRegionDeleteFulfillmentProvider,
|
||||
useAdminRegionDeletePaymentProvider,
|
||||
useAdminUpdateRegion,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateRegion hook", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminRegion,
|
||||
useAdminRegions,
|
||||
useAdminRegionFulfillmentOptions,
|
||||
useAdminRegions,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminRegions hook", () => {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import {
|
||||
useAdminCreateShippingProfile,
|
||||
useAdminUpdateShippingProfile,
|
||||
useAdminDeleteShippingProfile,
|
||||
useAdminCreateReservation,
|
||||
useAdminUpdateReservation,
|
||||
useAdminDeleteReservation,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateReservation,
|
||||
useAdminDeleteReservation,
|
||||
useAdminUpdateReservation,
|
||||
} from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateShippingProfile hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminReservation, useAdminReservations } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminReservation, useAdminReservations } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminShippingProfiles hook", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateReturnReason,
|
||||
useAdminUpdateReturnReason,
|
||||
useAdminDeleteReturnReason,
|
||||
useAdminUpdateReturnReason,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateReturnReason hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminReturnReason, useAdminReturnReasons } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminReturnReason, useAdminReturnReasons } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminReturnReasons hook", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminCancelReturn, useAdminReceiveReturn } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminReturns } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
|
||||
import {
|
||||
useAdminDeleteSalesChannel,
|
||||
useAdminCreateSalesChannel,
|
||||
useAdminUpdateSalesChannel,
|
||||
useAdminDeleteProductsFromSalesChannel,
|
||||
useAdminAddProductsToSalesChannel,
|
||||
} from "../../../../src"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminAddProductsToSalesChannel,
|
||||
useAdminCreateSalesChannel,
|
||||
useAdminDeleteProductsFromSalesChannel,
|
||||
useAdminDeleteSalesChannel,
|
||||
useAdminUpdateSalesChannel,
|
||||
} from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateSalesChannel hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminSalesChannel, useAdminSalesChannels } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminSalesChannel, useAdminSalesChannels } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminSalesChannel hook", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateShippingOption,
|
||||
useAdminUpdateShippingOption,
|
||||
useAdminDeleteShippingOption,
|
||||
useAdminUpdateShippingOption,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateShippingOption hook", () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminShippingOption,
|
||||
useAdminShippingOptions,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminShippingOptions hook", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateShippingProfile,
|
||||
useAdminUpdateShippingProfile,
|
||||
useAdminDeleteShippingProfile,
|
||||
useAdminUpdateShippingProfile,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateShippingProfile hook", () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminShippingProfile,
|
||||
useAdminShippingProfiles,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminShippingProfiles hook", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateStockLocation,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminStockLocation, useAdminStockLocations } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminUpdateStore,
|
||||
useAdminAddStoreCurrency,
|
||||
useAdminDeleteStoreCurrency,
|
||||
useAdminUpdateStore,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminUpdateStore hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminStore, useAdminStorePaymentProviders } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminStore, useAdminStorePaymentProviders } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminStore hook", () => {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateSwap,
|
||||
useAdminFulfillSwap,
|
||||
useAdminCancelSwap,
|
||||
useAdminCancelSwapFulfillment,
|
||||
useAdminCreateSwap,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminSwap, useAdminSwaps } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminSwap, useAdminSwaps } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminSwaps hook", () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminDeleteFile,
|
||||
useAdminCreatePresignedDownloadUrl,
|
||||
useAdminDeleteFile,
|
||||
} from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateUser,
|
||||
useAdminUpdateUser,
|
||||
useAdminDeleteUser,
|
||||
useAdminResetPassword,
|
||||
useAdminSendResetPasswordToken,
|
||||
useAdminUpdateUser,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateUser hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminUser, useAdminUsers } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminUser, useAdminUsers } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminUsers hook", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useAdminCreateVariant,
|
||||
useAdminUpdateVariant,
|
||||
useAdminDeleteVariant,
|
||||
useAdminUpdateVariant,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminCreateVariant hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAdminVariants, useAdminVariantsInventory } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useAdminVariants, useAdminVariantsInventory } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useAdminVariants hook", () => {
|
||||
|
||||
Reference in New Issue
Block a user