/** * MAMA Core Test Utilities * * Shared test helpers for mama-core consumers. * Optimizes test performance by sharing expensive resources (embedding model, DB adapter). * * @module test-utils * @version 1.1 */ import type Database from 'better-sqlite3'; /** * Returns migration SQL filenames sorted by their leading three-digit version. */ export declare function migrationFiles(): string[]; export declare function migrationVersion(file: string): number; /** * Apply migrations in order up to `maxVersion` (inclusive), starting from * `fromVersion`. Mirrors the production runner's two-part contract: * - skip files whose version is already recorded in `schema_version` * - tolerate `duplicate column` errors (legacy migrations that add * columns idempotently without recording into schema_version) */ export declare function applyMigrationsThrough(db: Database.Database, maxVersion: number, fromVersion?: number): void; /** * Preload embedding model (call once in globalSetup) * * This loads the embedding model into memory so subsequent tests don't pay the ~2s load time. * The model stays in memory due to singleton pattern in embeddings.ts. */ export declare function preloadEmbeddingModel(): Promise; /** * Create isolated test database * * Creates a unique test database and sets MAMA_DB_PATH. * Use in beforeAll() of each test file. * * @param testName - Unique test identifier (e.g., 'search-narrative') * @returns Test database path */ export declare function initTestDB(testName: string): Promise; /** * Cleanup test database * * Call in afterAll() to clean up test database files. * * @param testDbPath - Path returned by initTestDB */ export declare function cleanupTestDB(testDbPath?: string): Promise; /** * Cleanup all test databases * * Call in globalTeardown to clean up all test databases. */ export declare function cleanupAllTestDBs(): void; /** * Check if embeddings are available * * Returns false if embedding model failed to load (e.g., CI without ONNX). * Use to conditionally skip semantic search tests. */ export declare function isEmbeddingsAvailable(): Promise; /** * Create mock tool context * * Returns a mock context object for MCP tool tests. */ export declare function createMockToolContext(): { logger: { info: () => void; warn: () => void; error: () => void; }; }; /** * Suppress console output during tests * * Returns restore function to call after test. */ export declare function suppressConsole(): () => void; //# sourceMappingURL=test-utils.d.ts.map