/** * Parameterized Adapter Test Harness * * Provides `createAdapterTestSuite()` — a reusable function that runs * a standard battery of tests against any adapter that extends BaseAdapter. * * Verifies: * 1. Lifecycle (initialize, isReady, shutdown) * 2. Agent listing after registration * 3. Health check * 4. Agent availability * 5. Execution with registered agent * 6. Execution with unknown agent returns error * 7. Capabilities shape * 8. Shutdown clears agents * * Usage in test suites: * await createAdapterTestSuite({ * name: 'LangGraph', * create: () => new LangGraphAdapter(), * registerAgent: (adapter) => adapter.registerGraph('test', mockGraph), * agentId: 'test', * payload: { action: 'run', params: {} }, * }); * * @module AdapterTestHarness * @version 1.0.0 */ import type { AgentPayload, AgentContext } from '../types/agent-adapter'; import type { BaseAdapter } from '../adapters/base-adapter'; /** Test assertion function — compatible with test-adapters.ts pattern */ export type AssertFn = (condition: boolean, message: string) => void; /** Section header function */ export type SectionFn = (title: string) => void; /** Configuration for the parameterized test suite */ export interface AdapterTestSuiteConfig { /** Display name for the adapter under test */ name: string; /** Factory function that creates a fresh adapter instance */ create: () => BaseAdapter; /** * Register at least one agent on the adapter. * Called after initialize(). Should register an agent with the given agentId. */ registerAgent: (adapter: BaseAdapter) => void | Promise; /** The agent ID registered by registerAgent() */ agentId: string; /** A valid payload to use for execution tests */ payload: AgentPayload; /** Optional config to pass to initialize() */ initConfig?: Record; /** Optional custom context for execution */ context?: AgentContext; /** * If true, expect executeAgent to succeed. * If false, expect it to return an error (e.g. no backend configured). * Default: true. */ expectSuccess?: boolean; /** Custom assert function (defaults to built-in) */ assert?: AssertFn; /** Custom section function (defaults to built-in) */ section?: SectionFn; } /** Result from running the test suite */ export interface AdapterTestResult { /** Adapter name */ adapterName: string; /** Total assertions */ total: number; /** Passed assertions */ passed: number; /** Failed assertions */ failed: number; /** Individual test results */ results: Array<{ ok: boolean; message: string; }>; } /** * Run a standard battery of tests against any adapter. * * Uses the provided assert/section functions for output, or * falls back to console-based defaults. */ export declare function createAdapterTestSuite(config: AdapterTestSuiteConfig): Promise; //# sourceMappingURL=adapter-test-harness.d.ts.map