import path from "node:path"; import type { Config } from "../src/config"; import { type Database, openInMemoryDatabase } from "../src/db/client"; export const MIGRATIONS_FOLDER = path.resolve(import.meta.dirname, "../drizzle"); export function makeConfig(overrides: Partial = {}): Config { return { port: 8787, host: "127.0.0.1", dataDir: "/tmp/seiche-tests", sessionTtlMs: 8 * 60 * 60 * 1000, sessionAbsoluteTtlMs: 7 * 24 * 60 * 60 * 1000, maxLoginAttemptsPerMinute: 5, publicDir: null, external: { adapter: "example", baseUrl: "", apiKey: "", healthPath: "/health", listPath: "/items", timeoutMs: 10_000, retries: 2, cacheTtlMs: 30_000, }, ...overrides, }; } /** Base SQLite in-memory avec les migrations jouées. */ export async function openTestDb(): Promise { return openInMemoryDatabase(MIGRATIONS_FOLDER); }