fix: update tests for node type normalization changes

Fixed 3 failing tests after P0-R1 normalization implementation:
- workflow-validator-comprehensive.test.ts: Updated expectations for normalized node type lookups
- handlers-n8n-manager.test.ts: Updated createWorkflow test for normalized input
- workflow-validator.ts: Fixed SplitInBatches detection to use short-form node types

All tests now passing. Node types are normalized to short form before validation,
so tests must expect short-form types in assertions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-10-02 13:55:13 +02:00
parent ed7de10fd2
commit a8e0b1ed34
3 changed files with 17 additions and 6 deletions

View File

@@ -658,7 +658,7 @@ export class WorkflowValidator {
}
// Special validation for SplitInBatches node
if (sourceNode && sourceNode.type === 'n8n-nodes-base.splitInBatches') {
if (sourceNode && sourceNode.type === 'nodes-base.splitInBatches') {
this.validateSplitInBatchesConnection(
sourceNode,
outputIndex,
@@ -671,7 +671,7 @@ export class WorkflowValidator {
// Check for self-referencing connections
if (connection.node === sourceName) {
// This is only a warning for non-loop nodes
if (sourceNode && sourceNode.type !== 'n8n-nodes-base.splitInBatches') {
if (sourceNode && sourceNode.type !== 'nodes-base.splitInBatches') {
result.warnings.push({
type: 'warning',
message: `Node "${sourceName}" has a self-referencing connection. This can cause infinite loops.`

View File

@@ -230,8 +230,21 @@ describe('handlers-n8n-manager', () => {
data: testWorkflow,
message: 'Workflow "Test Workflow" created successfully with ID: test-workflow-id',
});
expect(mockApiClient.createWorkflow).toHaveBeenCalledWith(input);
expect(n8nValidation.validateWorkflowStructure).toHaveBeenCalledWith(input);
const expectedNormalizedInput = {
name: 'Test Workflow',
nodes: [{
id: 'node1',
name: 'Start',
type: 'nodes-base.start',
typeVersion: 1,
position: [100, 100],
parameters: {},
}],
connections: testWorkflow.connections,
};
expect(mockApiClient.createWorkflow).toHaveBeenCalledWith(expectedNormalizedInput);
expect(n8nValidation.validateWorkflowStructure).toHaveBeenCalledWith(expectedNormalizedInput);
});
it('should handle validation errors', async () => {

View File

@@ -579,7 +579,6 @@ describe('WorkflowValidator - Comprehensive Tests', () => {
const result = await validator.validateWorkflow(workflow as any);
expect(mockNodeRepository.getNode).toHaveBeenCalledWith('n8n-nodes-base.webhook');
expect(mockNodeRepository.getNode).toHaveBeenCalledWith('nodes-base.webhook');
});
@@ -599,7 +598,6 @@ describe('WorkflowValidator - Comprehensive Tests', () => {
const result = await validator.validateWorkflow(workflow as any);
expect(mockNodeRepository.getNode).toHaveBeenCalledWith('@n8n/n8n-nodes-langchain.agent');
expect(mockNodeRepository.getNode).toHaveBeenCalledWith('nodes-langchain.agent');
});