mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
fix: update langchain validation test to reflect v2.17.4 behavior
Updated test to reflect critical typeVersion validation fix from v2.17.4. ## Issue CI test failing: "should skip node repository lookup for langchain nodes" Expected getNode() NOT to be called for langchain nodes. ## Root Cause Test was written before v2.17.4 when langchain nodes completely bypassed validation. In v2.17.4, we fixed critical bug where langchain nodes with invalid typeVersion (e.g., 99999) passed validation but failed at runtime. ## Fix Updated test to reflect new correct behavior: - Langchain nodes SHOULD call getNode() for typeVersion validation - Prevents invalid typeVersion from bypassing validation - Parameter validation still skipped (handled by AI validators) ## Changes 1. Renamed test to clarify what it tests 2. Changed expectation: getNode() SHOULD be called 3. Check for no typeVersion errors (AI errors may exist) 4. Added new test for invalid typeVersion detection ## Impact - Zero breaking changes (only test update) - Validates v2.17.4 critical bug fix works correctly - Ensures langchain nodes don't bypass typeVersion validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -582,13 +582,14 @@ describe('WorkflowValidator - Comprehensive Tests', () => {
|
||||
expect(mockNodeRepository.getNode).toHaveBeenCalledWith('nodes-base.webhook');
|
||||
});
|
||||
|
||||
it('should skip node repository lookup for langchain nodes', async () => {
|
||||
it('should validate typeVersion but skip parameter validation for langchain nodes', async () => {
|
||||
const workflow = {
|
||||
nodes: [
|
||||
{
|
||||
id: '1',
|
||||
name: 'Agent',
|
||||
type: '@n8n/n8n-nodes-langchain.agent',
|
||||
typeVersion: 1,
|
||||
position: [100, 100],
|
||||
parameters: {}
|
||||
}
|
||||
@@ -598,9 +599,39 @@ describe('WorkflowValidator - Comprehensive Tests', () => {
|
||||
|
||||
const result = await validator.validateWorkflow(workflow as any);
|
||||
|
||||
// Langchain nodes should skip node repository validation
|
||||
// They are validated by dedicated AI validators instead
|
||||
expect(mockNodeRepository.getNode).not.toHaveBeenCalledWith('nodes-langchain.agent');
|
||||
// After v2.17.4 fix: Langchain nodes SHOULD call getNode for typeVersion validation
|
||||
// This prevents invalid typeVersion values from bypassing validation
|
||||
// But they skip parameter validation (handled by dedicated AI validators)
|
||||
expect(mockNodeRepository.getNode).toHaveBeenCalledWith('nodes-langchain.agent');
|
||||
|
||||
// Should not have typeVersion validation errors (other AI-specific errors may exist)
|
||||
const typeVersionErrors = result.errors.filter(e => e.message.includes('typeVersion'));
|
||||
expect(typeVersionErrors).toEqual([]);
|
||||
});
|
||||
|
||||
it('should catch invalid typeVersion for langchain nodes (v2.17.4 bug fix)', async () => {
|
||||
const workflow = {
|
||||
nodes: [
|
||||
{
|
||||
id: '1',
|
||||
name: 'Agent',
|
||||
type: '@n8n/n8n-nodes-langchain.agent',
|
||||
typeVersion: 99999, // Invalid - exceeds maximum
|
||||
position: [100, 100],
|
||||
parameters: {}
|
||||
}
|
||||
],
|
||||
connections: {}
|
||||
} as any;
|
||||
|
||||
const result = await validator.validateWorkflow(workflow as any);
|
||||
|
||||
// Critical: Before v2.17.4, this would pass validation but fail at runtime
|
||||
// After v2.17.4: Invalid typeVersion is caught during validation
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.errors.some(e =>
|
||||
e.message.includes('typeVersion 99999 exceeds maximum')
|
||||
)).toBe(true);
|
||||
});
|
||||
|
||||
it('should validate typeVersion for versioned nodes', async () => {
|
||||
|
||||
Reference in New Issue
Block a user