knowledgegraph-mcp
Version:
MCP server for enabling persistent knowledge storage for Claude through a knowledge graph with multiple storage backends
77 lines • 2.77 kB
TypeScript
/**
* Backend-Specific Test Helpers
*
* Provides utilities for handling backend-specific behavior in tests,
* such as different search capabilities and configuration requirements.
*/
import { StorageConfig, StorageType } from '../../storage/types.js';
import { SearchConfig } from '../../search/types.js';
import { KnowledgeGraphManager } from '../../core.js';
/**
* Backend capabilities and characteristics
*/
export interface BackendCapabilities {
supportsDatabaseSearch: boolean;
supportsTransactions: boolean;
supportsFullTextSearch: boolean;
isInMemory: boolean;
requiresExternalServer: boolean;
}
/**
* Get capabilities for a specific backend
*/
export declare function getBackendCapabilities(storageType: StorageType): BackendCapabilities;
/**
* Create appropriate search configuration for a backend
*/
export declare function createSearchConfig(storageType: StorageType): SearchConfig;
/**
* Create a KnowledgeGraphManager instance for testing with appropriate configuration
*/
export declare function createTestManager(config: StorageConfig, backendName: string, options?: {
customSearchConfig?: Partial<SearchConfig>;
timeout?: number;
}): Promise<KnowledgeGraphManager>;
/**
* Cleanup test manager and handle backend-specific cleanup
*/
export declare function cleanupTestManager(manager: KnowledgeGraphManager, backendName: string): Promise<void>;
/**
* Skip test if backend doesn't support required capability
*/
export declare function skipIfNotSupported(storageType: StorageType, capability: keyof BackendCapabilities, testContext?: any): boolean;
/**
* Create backend-specific test expectations
*/
export declare function createBackendExpectations(storageType: StorageType): {
/**
* Expect search to use database-level search if supported
*/
expectDatabaseSearch: (searchResults: any[]) => void;
/**
* Expect appropriate search performance characteristics
*/
expectSearchPerformance: (duration: number) => void;
/**
* Expect backend-specific error handling
*/
expectErrorHandling: (error: Error) => void;
};
/**
* Generate backend-specific test data
*/
export declare function generateTestData(storageType: StorageType, size?: number): {
name: string;
entityType: string;
observations: string[];
tags: string[];
}[];
/**
* Wait for backend-specific operations to complete
*/
export declare function waitForBackendOperation(storageType: StorageType, operation: () => Promise<any>): Promise<any>;
/**
* Create a test project name that's unique per backend
*/
export declare function createBackendTestProject(storageType: StorageType, testName: string, suffix?: string): string;
//# sourceMappingURL=backend-test-helpers.d.ts.map