delta-sync
Version:
A lightweight framework for bi-directional database synchronization with automatic version tracking and conflict resolution.
46 lines (45 loc) • 1.26 kB
TypeScript
import { DatabaseAdapter } from '../core/types';
export declare class AdapterTester {
private adapter;
private testStoreName;
private testResults;
constructor(adapter: DatabaseAdapter, testStoreName?: string);
private runTest;
runAllTests(): Promise<{
success: boolean;
results: Record<string, {
success: boolean;
message: string;
}>;
}>;
private testReadStore;
private testReadBulk;
private testPutBulk;
private testDeleteBulk;
private testClearStore;
private testGetStores;
}
export declare function testAdapterFunctionality(adapter: DatabaseAdapter, testStoreName?: string): Promise<{
success: boolean;
results: Record<string, {
success: boolean;
message: string;
}>;
}>;
/**
* 使用示例:
*
* const adapter = new YourDatabaseAdapter();
* const results = await testAdapterFunctionality(adapter);
*
* console.log('Test Results:', results);
* if (results.success) {
* console.log('All tests passed!');
* } else {
* console.log('Some tests failed:',
* Object.entries(results.results)
* .filter(([_, result]) => !result.success)
* .map(([name, result]) => `${name}: ${result.message}`)
* );
* }
*/