fix(integration): setup (#5511)

* fix(integration): setup
This commit is contained in:
Adrien de Peretti
2023-11-01 13:56:12 -04:00
committed by GitHub
parent 4692f54b49
commit 80fe362f33
45 changed files with 461 additions and 405 deletions
@@ -1,30 +1,30 @@
const path = require("path")
const { bootstrapApp } = require("../../../environment-helpers/bootstrap-app")
const {
startBootstrapApp,
} = require("../../../environment-helpers/bootstrap-app")
const { initDb, useDb } = require("../../../environment-helpers/use-db")
const { getContainer } = require("../../../environment-helpers/use-container")
const { useExpressServer } = require("../../../environment-helpers/use-api")
jest.setTimeout(50000)
describe("Inventory Module", () => {
let shutdownServer
let appContainer
let dbConnection
let express
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
const { container, app, port } = await bootstrapApp({ cwd })
appContainer = container
express = app.listen(port, (err) => {
process.send(port)
})
shutdownServer = await startBootstrapApp({ cwd })
appContainer = getContainer()
})
afterAll(async () => {
const db = useDb()
await db.shutdown()
express.close()
await shutdownServer()
})
afterEach(async () => {