fix(integration): setup (#5511)

* fix(integration): setup
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2023-11-01 13:56:12 -04:00
1 parent 4692f54b49
commit 80fe362f33
45 files changed
+461 -405

No files matched your search

@@ -1,22 +1,28 @@
const path = require("path")
const {
bootstrapApp,
startBootstrapApp,
} = require("../../../../environment-helpers/bootstrap-app")
const { initDb, useDb } = require("../../../../environment-helpers/use-db")
const { setPort, useApi } = require("../../../../environment-helpers/use-api")
const {
useApi,
useExpressServer,
} = require("../../../../environment-helpers/use-api")
const adminSeeder = require("../../../../helpers/admin-seeder")
const cartSeeder = require("../../../../helpers/cart-seeder")
const { simpleProductFactory } = require("../../../../factories")
const { simpleSalesChannelFactory } = require("../../../../factories")
const {
getContainer,
} = require("../../../../environment-helpers/use-container")
jest.setTimeout(30000)
const adminHeaders = { headers: { "x-medusa-access-token": "test_token" } }
describe("/store/carts", () => {
let express
let shutdownServer
let appContainer
let dbConnection
@@ -32,19 +38,14 @@ describe("/store/carts", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", "..", ".."))
dbConnection = await initDb({ cwd })
const { container, app, port } = await bootstrapApp({ cwd })
appContainer = container
setPort(port)
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 () => {