chore: Adjust global and knex types for global hooks

This commit is contained in:
Faruk AYDIN
2023-10-01 18:06:36 +02:00
parent 4ab6415f49
commit 3703390268

View File

@@ -1,11 +1,12 @@
import { client as knex } from '../../src/config/database'; import { client as knex } from '../../src/config/database';
import { Knex } from 'knex';
global.beforeAll(async () => { global.beforeAll(async () => {
global.knex = knex; (global as any).knex = knex as Knex;
}); });
global.beforeEach(async function () { global.beforeEach(async function () {
this.transaction = await global.knex.transaction(); this.transaction = await (global as any).knex.transaction();
}); });
global.afterEach(async function () { global.afterEach(async function () {
@@ -13,5 +14,5 @@ global.afterEach(async function () {
}); });
global.afterAll(async () => { global.afterAll(async () => {
global.knex.destroy(); (global as any).knex.destroy();
}); });