Raw
1 const { dropDatabase } = require("pg-god")
2
3 const DB_HOST = process.env.DB_HOST
4 const DB_USERNAME = process.env.DB_USERNAME
5 const DB_PASSWORD = process.env.DB_PASSWORD
6 const DB_NAME = process.env.DB_TEMP_NAME
7
8 const pgGodCredentials = {
9 user: DB_USERNAME,
10 password: DB_PASSWORD,
11 host: DB_HOST,
12 }
13
14 afterAll(async () => {
15 try {
16 await dropDatabase({ databaseName: DB_NAME }, pgGodCredentials)
17 } catch (e) {
18 console.error(
19 `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}`
20 )
21 }
22 })