Files
HIPCTF2/tests/backend/db-helper.ts
T

11 lines
492 B
TypeScript

import { INestApplication } from '@nestjs/common';
import { DatabaseInitService } from '../../backend/src/database/database-init.service';
/**
* Await database initialization (migrations + seed verification) on the
* given Nest app. Without this, integration tests that hit controllers
* will hit a fresh `:memory:` SQLite database with no tables.
*/
export async function initDb(app: INestApplication): Promise<void> {
await app.get<DatabaseInitService>(DatabaseInitService).init();
}