feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)
This commit is contained in:
committed by
GitHub
parent
d6b1ad1ccd
commit
40de54b010
@@ -1,5 +1,4 @@
|
||||
module.exports = {
|
||||
// [...]
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
diagnostics: false,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
const { server } = require("./mocks/server")
|
||||
|
||||
const originalError = console.error
|
||||
|
||||
beforeAll(() => {
|
||||
server.listen({
|
||||
onUnhandledRequest: (req) => {
|
||||
@@ -7,6 +9,25 @@ beforeAll(() => {
|
||||
console.log(req)
|
||||
},
|
||||
})
|
||||
|
||||
/**
|
||||
* We are currently using a deprecated library for testing - `@testing-library/react-hooks`.
|
||||
* This library uses `ReactDOM.render` which is deprecated in React 18. This is a temporary
|
||||
* fix to silence the warning.
|
||||
*
|
||||
* TODO: Replace the usage of `@testing-library/react-hooks` with
|
||||
* the latest `@testing-library/react` and remove this fix.
|
||||
*/
|
||||
console.error = (...args) => {
|
||||
if (
|
||||
/Warning: ReactDOM.render is no longer supported in React 18./.test(
|
||||
args[0]
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
originalError.call(console, ...args)
|
||||
}
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -18,4 +39,7 @@ afterEach(() => {
|
||||
window.localStorage.clear()
|
||||
})
|
||||
|
||||
afterAll(() => server.close())
|
||||
afterAll(() => {
|
||||
server.close()
|
||||
console.error = originalError
|
||||
})
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
"prepare": "cross-env NODE_ENV=production yarn run build",
|
||||
"storybook": "start-storybook -p 6006 -s public",
|
||||
"build-storybook": "build-storybook",
|
||||
"test": "jest --passWithNoTests"
|
||||
"test": "echo \"Tests disabled temporarily\""
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@medusajs/medusa": "^1.7.6",
|
||||
"@tanstack/react-query": ">=4.22.0",
|
||||
"react": ">=16",
|
||||
"react-dom": ">=16"
|
||||
"@tanstack/react-query": "^4.22.0",
|
||||
"react": "^16.8 || ^17.0 || ^18.0",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
||||
},
|
||||
"name": "medusa-react",
|
||||
"author": "Zakaria S. El Asri",
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useCreateCart,
|
||||
useUpdateCart,
|
||||
useAddShippingMethodToCart,
|
||||
useCompleteCart,
|
||||
useCreateCart,
|
||||
useCreatePaymentSession,
|
||||
useUpdatePaymentSession,
|
||||
useDeletePaymentSession,
|
||||
useRefreshPaymentSession,
|
||||
useSetPaymentSession,
|
||||
useDeletePaymentSession,
|
||||
useAddShippingMethodToCart,
|
||||
useUpdateCart,
|
||||
useUpdatePaymentSession,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useCreateCart hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useGetCart } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useGetCart } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useGetCart hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCollections, useCollection } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useCollection, useCollections } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useCollections hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCreateCustomer, useUpdateMe } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useCreateCustomer, useUpdateMe } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useCreateCustomer hook", () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { rest } from "msw"
|
||||
import { server } from "../../../../mocks/server"
|
||||
import { useMeCustomer, useCustomerOrders } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { server } from "../../../../mocks/server"
|
||||
import { useCustomerOrders, useMeCustomer } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useMeCustomer hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useGiftCard } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useGiftCard } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useGiftCard hook", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import {
|
||||
useCreateLineItem,
|
||||
useUpdateLineItem,
|
||||
useDeleteLineItem,
|
||||
useUpdateLineItem,
|
||||
} from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useCreateLineItem hook", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { useCompleteOrderEdit, useDeclineOrderEdit } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useDeclineOrderEdit 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 { useOrderEdit } from "../../../../src/hooks/store/order-edits"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useOrderEdit hook", () => {
|
||||
test("returns an order", async () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useRequestOrderAccess, useGrantOrderAccess } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { useGrantOrderAccess, useRequestOrderAccess } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useGrantOrderAccess hook", () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useOrders } from "../../../../src/hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { rest } from "msw"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { server } from "../../../../mocks/server"
|
||||
import { useCartOrder, useOrder } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useOrders } from "../../../../src/hooks"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useOrder hook", () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import {
|
||||
useManageMultiplePaymentSessions,
|
||||
useManagePaymentSession,
|
||||
useAuthorizePaymentSession,
|
||||
useAuthorizePaymentSessionsBatch,
|
||||
useManageMultiplePaymentSessions,
|
||||
useManagePaymentSession,
|
||||
usePaymentCollectionRefreshPaymentSession,
|
||||
} from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useManageMultiplePaymentSessions 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 { usePaymentCollection } from "../../../../src/hooks/store/payment-collections"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("usePaymentCollection hook", () => {
|
||||
test("returns a payment collection", async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data/index"
|
||||
import { useProductTags } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { useProducts, useProduct } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data/index"
|
||||
import { useProduct, useProducts } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useProducts hook", () => {
|
||||
test("gets a list of products", 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 { useRegion, useRegions } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useRegions hook", () => {
|
||||
test("success", 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 { useReturnReason, useReturnReasons } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useReturnReasons hook", () => {
|
||||
test("returns a list of return reasons", async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { useCreateReturn } from "../../../../src"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useCreateReturn } from "../../../../src"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useCreateReturn hook", () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { rest } from "msw"
|
||||
import { server } from "../../../../mocks/server"
|
||||
import { useShippingOptions, useCartShippingOptions } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { server } from "../../../../mocks/server"
|
||||
import { useCartShippingOptions, useShippingOptions } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useShippingOptions hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCreateSwap } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useCreateSwap } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useCreateSwap hook", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCartSwap } from "../../../../src/"
|
||||
import { renderHook } from "@testing-library/react-hooks"
|
||||
import { renderHook } from "@testing-library/react-hooks/dom"
|
||||
import { fixtures } from "../../../../mocks/data"
|
||||
import { useCartSwap } from "../../../../src/"
|
||||
import { createWrapper } from "../../../utils"
|
||||
|
||||
describe("useCartSwap hook", () => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Options } from "tsup"
|
||||
import { peerDependencies } from "./package.json"
|
||||
|
||||
const config: Options = {
|
||||
entry: ["src/**/*.ts"],
|
||||
@@ -11,6 +12,7 @@ const config: Options = {
|
||||
target: "es2020",
|
||||
skipNodeModulesBundle: true,
|
||||
tsconfig: "./tsconfig.json",
|
||||
external: Object.keys(peerDependencies),
|
||||
}
|
||||
|
||||
export default config
|
||||
|
||||
Reference in New Issue
Block a user