import { DynamicModule } from '@omnitron-dev/titan/nexus'; import { Kysely, Transaction } from 'kysely'; import { DatabaseManager } from '@omnitron-dev/titan-database'; import { MigrationRunner } from '@omnitron-dev/titan-database'; import { type CleanupStrategy, type IsolationLevel } from '@kysera/testing'; export declare const DATABASE_TESTING_SERVICE: unique symbol; import type { DatabaseModuleOptions } from '@omnitron-dev/titan-database'; export interface DatabaseTestingOptions extends Partial { transactional?: boolean; autoMigrate?: boolean; autoSeed?: boolean; seeds?: any[] | (() => Promise); autoClean?: boolean; preserveTables?: string[]; isolatedSchema?: boolean; schemaPrefix?: string; verbose?: boolean; } export declare class DatabaseTestingService { private manager; private options; private migrationRunner?; private transactionManager?; private currentTransaction?; private schemaName?; private isInitialized; constructor(manager: DatabaseManager, options: DatabaseTestingOptions, migrationRunner?: MigrationRunner | undefined, transactionManager?: unknown | undefined); initialize(): Promise; beforeEach(): Promise; afterEach(): Promise; afterAll(): Promise; cleanDatabase(): Promise; seedDatabase(seeds?: Array<{ table: string; data: unknown; }>): Promise; private convertBooleansForSqlite; private insertSeeds; private createIsolatedSchema; private dropIsolatedSchema; private getAllTables; private getDialect; createSavepoint(name: string): Promise; rollbackToSavepoint(name: string): Promise; execute(query: (db: Kysely>) => Promise): Promise; getTestConnection(): Promise> | Transaction>; factory>(table: string, generator: () => Partial | Promise>, count?: number): Promise; assertDatabaseHas(table: string, data: Record): Promise; assertDatabaseMissing(table: string, data: Record): Promise; assertDatabaseCount(table: string, count: number): Promise; runInTransaction(fn: (trx: Transaction) => Promise): Promise; runWithSavepoints(fn: (trx: Transaction) => Promise): Promise; runWithIsolation(isolationLevel: IsolationLevel, fn: (trx: Transaction) => Promise): Promise; cleanWithKysera(strategy?: CleanupStrategy, tables?: string[]): Promise; seedWithKysera(fn: (trx: Transaction) => Promise): Promise; snapshotTable(table: string): Promise; countTableRows(table: string): Promise; waitForCondition(condition: () => Promise | boolean, options?: { timeout?: number; interval?: number; timeoutMessage?: string; }): Promise; createDataFactory>(defaults: { [K in keyof T]: T[K] | (() => T[K]); }): (overrides?: Partial) => T; createManyFromFactory>(table: string, factory: (overrides?: Partial) => T, count: number, overrides?: Partial): Promise; } export declare class DatabaseTestingModule { static forTest(options?: DatabaseTestingOptions): DynamicModule; static createIsolatedModule(options?: DatabaseTestingOptions): Promise<{ module: DynamicModule; service?: DatabaseTestingService; cleanup: () => Promise; }>; static injectServiceIntoIsolatedModule(isolatedModuleResult: { module: DynamicModule; service?: DatabaseTestingService; cleanup: () => Promise; }, container: { resolveAsync: (token: any) => Promise; }): Promise; }