fix(utils,product): mikro orm connection loader (#4825)
Fix shared connection property check
This commit is contained in:
committed by
GitHub
parent
edf9ed4e59
commit
c53fa6cd3b
@@ -0,0 +1,29 @@
|
||||
import dbFactory from "./../../../environment-helpers/use-template-db"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
describe("Standalone Modules", () => {
|
||||
beforeAll(async () => {
|
||||
const DB_HOST = process.env.DB_HOST
|
||||
const DB_USERNAME = process.env.DB_USERNAME
|
||||
const DB_PASSWORD = process.env.DB_PASSWORD
|
||||
const DB_NAME = process.env.DB_TEMP_NAME
|
||||
|
||||
process.env.POSTGRES_URL = `postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}`
|
||||
await dbFactory.createFromTemplate(DB_NAME)
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
process.env.POSTGRES_URL = undefined
|
||||
})
|
||||
|
||||
it("Should migrate database and initialize Product module using connection string from environment variable ", async function () {
|
||||
const { initialize, runMigrations } = require("@medusajs/product")
|
||||
await runMigrations()
|
||||
|
||||
const product = await initialize()
|
||||
const productList = await product.list()
|
||||
|
||||
expect(productList).toEqual(expect.arrayContaining([]))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user