fix(integration): setup (#5511)

* fix(integration): setup
This commit is contained in:
Adrien de Peretti
2023-11-01 18:56:12 +01:00
committed by GitHub
parent 4692f54b49
commit 80fe362f33
45 changed files with 461 additions and 405 deletions
@@ -1,11 +1,12 @@
import { setPort, useApi } from "../../../environment-helpers/use-api"
import { useApi } from "../../../environment-helpers/use-api"
import { initDb, useDb } from "../../../environment-helpers/use-db"
import { simpleCartFactory, simpleRegionFactory } from "../../../factories"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { AxiosInstance } from "axios"
import path from "path"
import { bootstrapApp } from "../../../environment-helpers/bootstrap-app"
import { startBootstrapApp } from "../../../environment-helpers/bootstrap-app"
import { getContainer } from "../../../environment-helpers/use-container"
import adminSeeder from "../../../helpers/admin-seeder"
jest.setTimeout(5000000)
@@ -30,24 +31,19 @@ const env = {
describe("Link Modules", () => {
let medusaContainer
let dbConnection
let express
let shutdownServer
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd, env } as any)
const { container, app, port } = await bootstrapApp({ cwd, env })
medusaContainer = container
setPort(port)
express = app.listen(port)
shutdownServer = await startBootstrapApp({ cwd, env })
medusaContainer = getContainer()
})
afterAll(async () => {
const db = useDb()
await db.shutdown()
express.close()
await shutdownServer()
})
beforeEach(async () => {