Files
medusa-store/integration-tests/setup.js
Adrien de Peretti 80fe362f33 fix(integration): setup (#5511)
* fix(integration): setup
2023-11-01 13:56:12 -04:00

23 lines
601 B
JavaScript

const { dropDatabase } = require("pg-god")
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
const pgGodCredentials = {
user: DB_USERNAME,
password: DB_PASSWORD,
host: DB_HOST,
}
afterAll(async () => {
try {
await dropDatabase({ databaseName: DB_NAME }, pgGodCredentials)
} catch (e) {
console.error(
`This might fail if it is run during the unit tests since there is no database to drop. Otherwise, please check what is the issue. ${e.message}`
)
}
})