test: add teardown dependency to clean db after tests

This commit is contained in:
Jakub P.
2024-07-22 15:42:21 +02:00
parent 129327f40d
commit 37d02eba02
5 changed files with 50 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
const fileExtension = 'js';
const knexConfig = {
client: 'pg',
connection: {
host: process.env.POSTGRES_HOST,
user: process.env.POSTGRES_USERNAME,
port: process.env.POSTGRES_PORT,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DATABASE
},
searchPath: ['public'],
pool: { min: 0, max: 20 },
migrations: {
directory: '../../packages/backend/src/db/migrations/',
extension: fileExtension,
loadExtensions: [`.${fileExtension}`],
},
seeds: {
directory: '../../packages/backend/src/db/seeds',
},
...(process.env.APP_ENV === 'test' ? knexSnakeCaseMappers() : {}),
};
export default knexConfig;