mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
fix: correct error code access path in integration tests
The validation errors have the code inside details.code, not at the top level. Updated all integration tests to access e.details?.code || e.code instead of e.code. This fixes all 23 failing integration tests: - AI Agent validation tests - AI Tool validation tests - Chat Trigger validation tests - E2E validation tests - LLM Chain validation tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -89,7 +89,7 @@ describe('Integration: AI Agent Validation', () => {
|
||||
expect(data.errors).toBeDefined();
|
||||
expect(data.errors!.length).toBeGreaterThan(0);
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MISSING_LANGUAGE_MODEL');
|
||||
|
||||
const errorMessages = data.errors!.map(e => e.message).join(' ');
|
||||
@@ -298,7 +298,7 @@ describe('Integration: AI Agent Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('STREAMING_WITH_MAIN_OUTPUT');
|
||||
});
|
||||
|
||||
@@ -352,7 +352,7 @@ describe('Integration: AI Agent Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MULTIPLE_MEMORY_CONNECTIONS');
|
||||
});
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ describe('Integration: AI Tool Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MISSING_TOOL_DESCRIPTION');
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ describe('Integration: AI Tool Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MISSING_URL');
|
||||
});
|
||||
|
||||
@@ -196,7 +196,7 @@ describe('Integration: AI Tool Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MISSING_CODE');
|
||||
});
|
||||
|
||||
@@ -268,7 +268,7 @@ describe('Integration: AI Tool Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MISSING_TOOL_DESCRIPTION');
|
||||
});
|
||||
|
||||
@@ -340,7 +340,7 @@ describe('Integration: AI Tool Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MISSING_WORKFLOW_ID');
|
||||
});
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ describe('Integration: Chat Trigger Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('STREAMING_WRONG_TARGET');
|
||||
|
||||
const errorMessages = data.errors!.map(e => e.message).join(' ');
|
||||
@@ -139,7 +139,7 @@ describe('Integration: Chat Trigger Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MISSING_CONNECTIONS');
|
||||
});
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ describe('Integration: End-to-End AI Workflow Validation', () => {
|
||||
expect(validationData.errors!.length).toBeGreaterThan(3);
|
||||
|
||||
// Verify specific errors are detected
|
||||
const errorCodes = validationData.errors!.map(e => e.code);
|
||||
const errorCodes = validationData.errors!.map(e => e.details?.code || e.code);
|
||||
|
||||
expect(errorCodes).toContain('MISSING_LANGUAGE_MODEL'); // AI Agent
|
||||
expect(errorCodes).toContain('MISSING_PROMPT_TEXT'); // AI Agent
|
||||
|
||||
@@ -84,7 +84,7 @@ describe('Integration: Basic LLM Chain Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MISSING_LANGUAGE_MODEL');
|
||||
});
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('Integration: Basic LLM Chain Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MISSING_PROMPT_TEXT');
|
||||
});
|
||||
|
||||
@@ -267,7 +267,7 @@ describe('Integration: Basic LLM Chain Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('MULTIPLE_LANGUAGE_MODELS');
|
||||
});
|
||||
|
||||
@@ -323,7 +323,7 @@ describe('Integration: Basic LLM Chain Validation', () => {
|
||||
expect(data.valid).toBe(false);
|
||||
expect(data.errors).toBeDefined();
|
||||
|
||||
const errorCodes = data.errors!.map(e => e.code);
|
||||
const errorCodes = data.errors!.map(e => e.details?.code || e.code);
|
||||
expect(errorCodes).toContain('TOOLS_NOT_SUPPORTED');
|
||||
|
||||
const errorMessages = data.errors!.map(e => e.message).join(' ');
|
||||
|
||||
Reference in New Issue
Block a user