task_receipts/src/server/db/__tests__/setup.ts

14 lines
280 B
TypeScript

import knex from 'knex';
import config from '../../../../knexfile';
export const testDb = knex(config.test);
beforeAll(async () => {
// Run migrations
await testDb.migrate.latest();
});
afterAll(async () => {
// Close the database connection
await testDb.destroy();
});