From 459c4454ada7ca01d9868efafec8235686552099 Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 17 Nov 2026 21:42:09 +0100 Subject: [PATCH] test: import vi in the trip members suite and type the move's SQLite ORM options --- server/tests/postgres/sqlite-move.test.ts | 9 ++++++--- server/tests/unit/mcp/tools-trip-members.test.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/tests/postgres/sqlite-move.test.ts b/server/tests/postgres/sqlite-move.test.ts index f0dee47ae..2b6c05cac 100644 --- a/server/tests/postgres/sqlite-move.test.ts +++ b/server/tests/postgres/sqlite-move.test.ts @@ -44,7 +44,7 @@ import { setAppSetting, setUserSetting } from '../helpers/factories/settings'; import { makeTrip, readTripDays } from '../helpers/factories/trips'; import { makeUser } from '../helpers/factories/users'; import { databaseUrl, withAdmin } from './databases'; -import { MikroORM, type EntityClass } from '@mikro-orm/core'; +import { MikroORM, type EntityClass, type Options } from '@mikro-orm/core'; import type { AbstractSqlConnection } from '@mikro-orm/sql'; import type { INestApplication } from '@nestjs/common'; @@ -69,12 +69,15 @@ async function migratedSqlite(file: string): Promise { handle = new Database(file); handle.pragma('foreign_keys = ON'); const config = buildOrmConfig(new SqliteEngine()); - const orm = await MikroORM.init({ + // Typed as the engine's plain Options: the bound driver alone would make + // init infer the SQLite driver's own entity manager, which config does not name. + const options: Options = { ...config, driver: createBoundSqliteDriver(() => handle), dbName: file, migrations: { ...config.migrations, silent: true }, - }); + }; + const orm = await MikroORM.init(options); await runSchemaBootstrap(orm, { snapshot: false }); return orm; } diff --git a/server/tests/unit/mcp/tools-trip-members.test.ts b/server/tests/unit/mcp/tools-trip-members.test.ts index b5b13470f..14bc2b18c 100644 --- a/server/tests/unit/mcp/tools-trip-members.test.ts +++ b/server/tests/unit/mcp/tools-trip-members.test.ts @@ -25,7 +25,7 @@ import { resetDatabase } from '../../helpers/reset-database'; import { bootTestApp } from '../../helpers/test-app'; import { MikroORM } from '@mikro-orm/core'; -import { describe, it, expect, beforeAll, beforeEach, afterAll } from 'vitest'; +import { describe, it, expect, beforeAll, beforeEach, afterAll, vi } from 'vitest'; const realtime = new FakeRealtimeService(); const broadcastMock = realtime.broadcastMock;