Files
automatisch/packages/backend/test/setup/global-hooks.ts
2023-10-03 23:40:12 +02:00

18 lines
354 B
TypeScript

import { client as knex } from '../../src/config/database';
global.beforeAll(async () => {
global.knex = knex;
});
global.beforeEach(async function () {
this.transaction = await global.knex.transaction();
});
global.afterEach(async function () {
await this.transaction.rollback();
});
global.afterAll(async () => {
global.knex.destroy();
});