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

View File

@@ -6,24 +6,27 @@ import {
pipe,
} from "@medusajs/workflows"
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 { initDb, useDb } from "../../../../environment-helpers/use-db"
jest.setTimeout(30000)
describe("CreateInventoryItem workflow", function () {
let medusaContainer
let shutdownServer
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", "..", ".."))
await initDb({ cwd } as any)
const { container } = await bootstrapApp({ cwd })
medusaContainer = container
await initDb({ cwd })
shutdownServer = await startBootstrapApp({ cwd, skipExpressListen: true })
medusaContainer = getContainer()
})
afterAll(async () => {
const db = useDb()
await db.shutdown()
await shutdownServer()
})
it("should compensate all the invoke if something fails", async () => {

View File

@@ -7,24 +7,29 @@ import {
pipe,
} from "@medusajs/workflows"
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 { initDb, useDb } from "../../../../environment-helpers/use-db"
jest.setTimeout(30000)
describe("CreateProduct workflow", function () {
let medusaContainer
let shutdownServer
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", "..", ".."))
await initDb({ cwd } as any)
const { container } = await bootstrapApp({ cwd })
medusaContainer = container
await initDb({ cwd })
shutdownServer = await startBootstrapApp({ cwd, skipExpressListen: true })
medusaContainer = getContainer()
})
afterAll(async () => {
console.log("GLOABL GC()", typeof global)
const db = useDb()
await db.shutdown()
await shutdownServer()
})
it("should compensate all the invoke if something fails", async () => {

View File

@@ -7,29 +7,29 @@ import {
} from "@medusajs/workflows"
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 { initDb, useDb } from "../../../../environment-helpers/use-db"
import { simpleProductFactory } from "../../../../factories"
jest.setTimeout(30000)
describe("UpdateProduct workflow", function () {
let medusaProcess
let dbConnection
let medusaContainer
let shutdownServer
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", "..", ".."))
dbConnection = await initDb({ cwd } as any)
const { container } = await bootstrapApp({ cwd })
medusaContainer = container
dbConnection = await initDb({ cwd })
shutdownServer = await startBootstrapApp({ cwd, skipExpressListen: true })
medusaContainer = getContainer()
})
afterAll(async () => {
const db = useDb()
await db.shutdown()
medusaProcess.kill()
await shutdownServer()
})
beforeEach(async () => {