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:
Philip Korsholm
2024-01-25 10:37:38 +08:00
committed by GitHub
parent 134af77667
commit efd9204e26
40 changed files with 1042 additions and 486 deletions

View File

@@ -4,12 +4,30 @@ import { SqlEntityManager } from "@mikro-orm/postgresql"
import { initialize } from "../../../../src/initialize"
import { DB_URL, MikroOrmWrapper } from "../../../utils"
import { createPaymentCollections } from "../../../__fixtures__/payment-collection"
import { getInitModuleConfig } from "../../../utils/get-init-module-config"
import { initModules } from "medusa-test-utils"
import { Modules } from "@medusajs/modules-sdk"
jest.setTimeout(30000)
describe("Payment Module Service", () => {
let service: IPaymentModuleService
let repositoryManager: SqlEntityManager
let shutdownFunc: () => Promise<void>
beforeAll(async () => {
const initModulesConfig = getInitModuleConfig()
const { medusaApp, shutdown } = await initModules(initModulesConfig)
service = medusaApp.modules[Modules.PAYMENT]
shutdownFunc = shutdown
})
afterAll(async () => {
await shutdownFunc()
})
beforeEach(async () => {
await MikroOrmWrapper.setupDatabase()