chore: remove container registration name (#9137)
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { IEventBusModuleService } from "@medusajs/types"
|
||||
import { CommonEvents, Modules } from "@medusajs/utils"
|
||||
import fs from "fs/promises"
|
||||
import { TestEventUtils, medusaIntegrationTestRunner } from "medusa-test-utils"
|
||||
import path from "path"
|
||||
import {
|
||||
adminHeaders,
|
||||
createAdminUser,
|
||||
} from "../../../../helpers/create-admin-user"
|
||||
import { getProductFixture } from "../../../../helpers/fixtures"
|
||||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
|
||||
jest.setTimeout(50000)
|
||||
|
||||
@@ -56,7 +56,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
let eventBus: IEventBusModuleService
|
||||
beforeAll(async () => {
|
||||
eventBus = getContainer().resolve(ModuleRegistrationName.EVENT_BUS)
|
||||
eventBus = getContainer().resolve(Modules.EVENT_BUS)
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -201,7 +201,7 @@ medusaIntegrationTestRunner({
|
||||
describe("POST /admin/products/export", () => {
|
||||
it("should export a csv file containing the expected products", async () => {
|
||||
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
|
||||
"notification.notification.created",
|
||||
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
|
||||
eventBus
|
||||
)
|
||||
|
||||
@@ -243,7 +243,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should export a csv file with categories", async () => {
|
||||
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
|
||||
"notification.notification.created",
|
||||
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
|
||||
eventBus
|
||||
)
|
||||
|
||||
@@ -269,7 +269,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should export a csv file with region prices", async () => {
|
||||
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
|
||||
"notification.notification.created",
|
||||
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
|
||||
eventBus
|
||||
)
|
||||
|
||||
@@ -328,7 +328,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should export a csv file filtered by specific products", async () => {
|
||||
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
|
||||
"notification.notification.created",
|
||||
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
|
||||
eventBus
|
||||
)
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { IEventBusModuleService } from "@medusajs/types"
|
||||
import { CommonEvents, Modules } from "@medusajs/utils"
|
||||
import FormData from "form-data"
|
||||
import fs from "fs/promises"
|
||||
import { TestEventUtils, medusaIntegrationTestRunner } from "medusa-test-utils"
|
||||
import path from "path"
|
||||
import {
|
||||
adminHeaders,
|
||||
createAdminUser,
|
||||
} from "../../../../helpers/create-admin-user"
|
||||
import FormData from "form-data"
|
||||
import fs from "fs/promises"
|
||||
import path from "path"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { getProductFixture } from "../../../../helpers/fixtures"
|
||||
|
||||
jest.setTimeout(50000)
|
||||
@@ -40,7 +40,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
let eventBus: IEventBusModuleService
|
||||
beforeAll(async () => {
|
||||
eventBus = getContainer().resolve(ModuleRegistrationName.EVENT_BUS)
|
||||
eventBus = getContainer().resolve(Modules.EVENT_BUS)
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -127,7 +127,7 @@ medusaIntegrationTestRunner({
|
||||
].forEach((testcase) => {
|
||||
it(`should import a previously exported products CSV file ${testcase.name}`, async () => {
|
||||
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
|
||||
"notification.notification.created",
|
||||
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
|
||||
eventBus
|
||||
)
|
||||
|
||||
@@ -383,7 +383,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should import product with categories", async () => {
|
||||
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
|
||||
"notification.notification.created",
|
||||
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
|
||||
eventBus
|
||||
)
|
||||
|
||||
@@ -452,7 +452,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should ignore non-existent fields being present in the CSV that don't start with Product or Variant", async () => {
|
||||
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
|
||||
"notification.notification.created",
|
||||
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
|
||||
eventBus
|
||||
)
|
||||
|
||||
@@ -502,7 +502,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should fail on non-existent product fields being present in the CSV", async () => {
|
||||
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
|
||||
"notification.notification.created",
|
||||
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
|
||||
eventBus
|
||||
)
|
||||
|
||||
@@ -552,7 +552,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("supports importing the v1 template", async () => {
|
||||
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
|
||||
"notification.notification.created",
|
||||
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
|
||||
eventBus
|
||||
)
|
||||
|
||||
@@ -781,6 +781,7 @@ medusaIntegrationTestRunner({
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
}),
|
||||
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
title: "Test product",
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { IStoreModuleService } from "@medusajs/types"
|
||||
import {
|
||||
ApiKeyType,
|
||||
ModuleRegistrationName,
|
||||
ProductStatus,
|
||||
} from "@medusajs/utils"
|
||||
import { ApiKeyType, Modules, ProductStatus } from "@medusajs/utils"
|
||||
import { medusaIntegrationTestRunner } from "medusa-test-utils"
|
||||
import {
|
||||
adminHeaders,
|
||||
@@ -91,7 +87,7 @@ medusaIntegrationTestRunner({
|
||||
await createAdminUser(dbConnection, adminHeaders, appContainer)
|
||||
|
||||
const storeModule: IStoreModuleService = appContainer.resolve(
|
||||
ModuleRegistrationName.STORE
|
||||
Modules.STORE
|
||||
)
|
||||
// A default store is created when the app is started, so we want to delete that one and create one specifically for our tests.
|
||||
const defaultId = (await api.get("/admin/stores", adminHeaders)).data
|
||||
@@ -540,7 +536,7 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const service = appContainer.resolve(ModuleRegistrationName.STORE)
|
||||
const service = appContainer.resolve(Modules.STORE)
|
||||
const [store] = await service.listStores()
|
||||
|
||||
if (store) {
|
||||
@@ -1158,7 +1154,7 @@ medusaIntegrationTestRunner({
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const service = appContainer.resolve(ModuleRegistrationName.STORE)
|
||||
const service = appContainer.resolve(Modules.STORE)
|
||||
const [store] = await service.listStores()
|
||||
|
||||
if (store) {
|
||||
|
||||
Reference in New Issue
Block a user