mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 05:23:08 +00:00
Implemented comprehensive integration tests for workflow validation operations. Test Coverage (12 scenarios): - validate-workflow.test.ts: 12 test scenarios * Valid workflow with all 4 profiles (runtime, strict, ai-friendly, minimal) * Invalid workflow detection (bad node types, missing connections) * Selective validation (nodes only, connections only, expressions only) * Error handling (non-existent workflow, invalid parameters) * Response format verification Infrastructure: - Created node-repository utility for integration tests - Provides singleton NodeRepository instance for validation tests - Uses production nodes.db database Test Results: - All 83 integration tests passing (Phase 1-6A complete) - Validation tests cover all 4 validation profiles - Tests verify actual validation against real n8n instance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
976 B
TypeScript
36 lines
976 B
TypeScript
/**
|
|
* Node Repository Utility for Integration Tests
|
|
*
|
|
* Provides a singleton NodeRepository instance for integration tests
|
|
* that require validation or autofix functionality.
|
|
*/
|
|
|
|
import path from 'path';
|
|
import { createDatabaseAdapter } from '../../../../src/database/database-adapter';
|
|
import { NodeRepository } from '../../../../src/database/node-repository';
|
|
|
|
let repositoryInstance: NodeRepository | null = null;
|
|
|
|
/**
|
|
* Get or create NodeRepository instance
|
|
* Uses the production nodes.db database
|
|
*/
|
|
export async function getNodeRepository(): Promise<NodeRepository> {
|
|
if (repositoryInstance) {
|
|
return repositoryInstance;
|
|
}
|
|
|
|
const dbPath = path.join(process.cwd(), 'data/nodes.db');
|
|
const db = await createDatabaseAdapter(dbPath);
|
|
repositoryInstance = new NodeRepository(db);
|
|
|
|
return repositoryInstance;
|
|
}
|
|
|
|
/**
|
|
* Reset repository instance (useful for test cleanup)
|
|
*/
|
|
export function resetNodeRepository(): void {
|
|
repositoryInstance = null;
|
|
}
|