Feat(medusa-test-utils, authentication, customer, cart, payment, pricing, product, promotion): Add initModule util (#6200)
* use initModules instead of initialize when runnning auth module integration tests * rm unused module-config * correct db schema fix * update authentication integration tests w/ initModule * update cart integration tests w/ initModule * update customer integration tests w/ initModule * update payment integration tests w/ initModule * update pricing integration tests w/ initModule * update product integration tests w/ initModule * update promotion integration tests w/ initModule * add initModule to more product tests and return medusaApp from initModule * align moduleOptions naming * update dependencies
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk"
|
||||
|
||||
import { DB_URL } from "./database"
|
||||
import { EventBusService } from "../__fixtures__/event-bus"
|
||||
|
||||
export function getInitModuleConfig(
|
||||
additionalOptions: any = {},
|
||||
injectedDependencies: null | Record<string, any> = null
|
||||
) {
|
||||
const moduleOptions = {
|
||||
defaultAdapterOptions: {
|
||||
database: {
|
||||
clientUrl: DB_URL,
|
||||
schema: process.env.MEDUSA_PRODUCT_DB_SCHEMA,
|
||||
},
|
||||
},
|
||||
...additionalOptions,
|
||||
}
|
||||
|
||||
const modulesConfig_ = {
|
||||
[Modules.PRODUCT]: {
|
||||
definition: ModulesDefinition[Modules.PRODUCT],
|
||||
options: moduleOptions,
|
||||
},
|
||||
}
|
||||
|
||||
const defaultInjectedDependencies = {
|
||||
eventBusModuleService: new EventBusService(),
|
||||
}
|
||||
|
||||
return {
|
||||
injectedDependencies: injectedDependencies ?? defaultInjectedDependencies,
|
||||
modulesConfig: modulesConfig_,
|
||||
databaseConfig: {
|
||||
clientUrl: DB_URL,
|
||||
schema: process.env.MEDUSA_PRODUCT_DB_SCHEMA,
|
||||
},
|
||||
joinerConfig: [],
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
export * from "./database"
|
||||
export * from "./get-init-module-config"
|
||||
|
||||
Reference in New Issue
Block a user