mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 05:23:08 +00:00
fix: resolve TypeScript linting errors in Phase 3 test files
- Fixed tags format from object array to string array in all test files - Added type assertions for response.data in get-workflow-details.test.ts - Added non-null assertions for workflow.nodes in get-workflow.test.ts - All TypeScript linting errors now resolved 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -46,7 +46,7 @@ describe('Integration: handleGetWorkflowDetails', () => {
|
||||
const workflow = {
|
||||
...SIMPLE_WEBHOOK_WORKFLOW,
|
||||
name: createTestWorkflowName('Get Details - Basic'),
|
||||
tags: [{ name: 'mcp-integration-test' }]
|
||||
tags: ['mcp-integration-test']
|
||||
};
|
||||
|
||||
const created = await client.createWorkflow(workflow);
|
||||
@@ -64,7 +64,7 @@ describe('Integration: handleGetWorkflowDetails', () => {
|
||||
expect(response.data).toBeDefined();
|
||||
|
||||
// handleGetWorkflowDetails returns { workflow, executionStats, hasWebhookTrigger, webhookPath }
|
||||
const details = response.data.workflow;
|
||||
const details = (response.data as any).workflow;
|
||||
|
||||
// Verify basic details
|
||||
expect(details).toBeDefined();
|
||||
@@ -90,9 +90,9 @@ describe('Integration: handleGetWorkflowDetails', () => {
|
||||
...SIMPLE_WEBHOOK_WORKFLOW,
|
||||
name: createTestWorkflowName('Get Details - With Metadata'),
|
||||
tags: [
|
||||
{ name: 'mcp-integration-test' },
|
||||
{ name: 'test-category' },
|
||||
{ name: 'integration' }
|
||||
'mcp-integration-test',
|
||||
'test-category',
|
||||
'integration'
|
||||
],
|
||||
settings: {
|
||||
executionOrder: 'v1' as const,
|
||||
@@ -110,7 +110,7 @@ describe('Integration: handleGetWorkflowDetails', () => {
|
||||
// Retrieve workflow details using MCP handler
|
||||
const response = await handleGetWorkflowDetails({ id: created.id }, mcpContext);
|
||||
expect(response.success).toBe(true);
|
||||
const details = response.data.workflow;
|
||||
const details = (response.data as any).workflow;
|
||||
|
||||
// Verify metadata is present (tags may be undefined in API response)
|
||||
// Note: n8n API behavior for tags varies - they may not be returned
|
||||
@@ -136,7 +136,7 @@ describe('Integration: handleGetWorkflowDetails', () => {
|
||||
const workflow = {
|
||||
...SIMPLE_WEBHOOK_WORKFLOW,
|
||||
name: createTestWorkflowName('Get Details - Version History'),
|
||||
tags: [{ name: 'mcp-integration-test' }]
|
||||
tags: ['mcp-integration-test']
|
||||
};
|
||||
|
||||
const created = await client.createWorkflow(workflow);
|
||||
@@ -149,7 +149,7 @@ describe('Integration: handleGetWorkflowDetails', () => {
|
||||
// Get initial version using MCP handler
|
||||
const initialResponse = await handleGetWorkflowDetails({ id: created.id }, mcpContext);
|
||||
expect(initialResponse.success).toBe(true);
|
||||
const initialDetails = initialResponse.data.workflow;
|
||||
const initialDetails = (initialResponse.data as any).workflow;
|
||||
const initialVersionId = initialDetails.versionId;
|
||||
const initialUpdatedAt = initialDetails.updatedAt;
|
||||
|
||||
@@ -163,7 +163,7 @@ describe('Integration: handleGetWorkflowDetails', () => {
|
||||
// Get updated details using MCP handler
|
||||
const updatedResponse = await handleGetWorkflowDetails({ id: created.id }, mcpContext);
|
||||
expect(updatedResponse.success).toBe(true);
|
||||
const updatedDetails = updatedResponse.data.workflow;
|
||||
const updatedDetails = (updatedResponse.data as any).workflow;
|
||||
|
||||
// Verify version changed
|
||||
expect(updatedDetails.versionId).toBeDefined();
|
||||
@@ -184,7 +184,7 @@ describe('Integration: handleGetWorkflowDetails', () => {
|
||||
const workflow = {
|
||||
...SIMPLE_WEBHOOK_WORKFLOW,
|
||||
name: createTestWorkflowName('Get Details - Execution Stats'),
|
||||
tags: [{ name: 'mcp-integration-test' }]
|
||||
tags: ['mcp-integration-test']
|
||||
};
|
||||
|
||||
const created = await client.createWorkflow(workflow);
|
||||
@@ -197,7 +197,7 @@ describe('Integration: handleGetWorkflowDetails', () => {
|
||||
// Retrieve workflow details using MCP handler
|
||||
const response = await handleGetWorkflowDetails({ id: created.id }, mcpContext);
|
||||
expect(response.success).toBe(true);
|
||||
const details = response.data.workflow;
|
||||
const details = (response.data as any).workflow;
|
||||
|
||||
// Verify execution-related fields exist
|
||||
// Note: New workflows won't have executions, but fields should be present
|
||||
|
||||
@@ -47,8 +47,8 @@ describe('Integration: handleGetWorkflowMinimal', () => {
|
||||
...SIMPLE_WEBHOOK_WORKFLOW,
|
||||
name: createTestWorkflowName('Get Minimal - Inactive'),
|
||||
tags: [
|
||||
{ name: 'mcp-integration-test' },
|
||||
{ name: 'minimal-test' }
|
||||
'mcp-integration-test',
|
||||
'minimal-test'
|
||||
]
|
||||
};
|
||||
|
||||
@@ -97,8 +97,8 @@ describe('Integration: handleGetWorkflowMinimal', () => {
|
||||
...SIMPLE_WEBHOOK_WORKFLOW,
|
||||
name: createTestWorkflowName('Get Minimal - Active'),
|
||||
tags: [
|
||||
{ name: 'mcp-integration-test' },
|
||||
{ name: 'minimal-test-active' }
|
||||
'mcp-integration-test',
|
||||
'minimal-test-active'
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('Integration: handleGetWorkflowStructure', () => {
|
||||
const workflow = {
|
||||
...SIMPLE_WEBHOOK_WORKFLOW,
|
||||
name: createTestWorkflowName('Get Structure - Simple'),
|
||||
tags: [{ name: 'mcp-integration-test' }]
|
||||
tags: ['mcp-integration-test']
|
||||
};
|
||||
|
||||
const created = await client.createWorkflow(workflow);
|
||||
@@ -92,7 +92,7 @@ describe('Integration: handleGetWorkflowStructure', () => {
|
||||
const workflow = {
|
||||
...MULTI_NODE_WORKFLOW,
|
||||
name: createTestWorkflowName('Get Structure - Complex'),
|
||||
tags: [{ name: 'mcp-integration-test' }]
|
||||
tags: ['mcp-integration-test']
|
||||
};
|
||||
|
||||
const created = await client.createWorkflow(workflow);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { describe, it, expect, beforeEach, afterEach, afterAll } from 'vitest';
|
||||
import { createTestContext, TestContext, createTestWorkflowName } from '../utils/test-context';
|
||||
import { getTestN8nClient } from '../utils/n8n-client';
|
||||
import { N8nApiClient } from '../../../../src/services/n8n-api-client';
|
||||
import { Workflow } from '../../../../src/types/n8n-api';
|
||||
import { SIMPLE_WEBHOOK_WORKFLOW } from '../utils/fixtures';
|
||||
import { cleanupOrphanedWorkflows } from '../utils/cleanup-helpers';
|
||||
import { createMcpContext } from '../utils/mcp-context';
|
||||
@@ -46,7 +47,7 @@ describe('Integration: handleGetWorkflow', () => {
|
||||
const workflow = {
|
||||
...SIMPLE_WEBHOOK_WORKFLOW,
|
||||
name: createTestWorkflowName('Get Workflow - Complete Data'),
|
||||
tags: [{ name: 'mcp-integration-test' }]
|
||||
tags: ['mcp-integration-test']
|
||||
};
|
||||
|
||||
const created = await client.createWorkflow(workflow);
|
||||
@@ -63,14 +64,14 @@ describe('Integration: handleGetWorkflow', () => {
|
||||
expect(response.success).toBe(true);
|
||||
expect(response.data).toBeDefined();
|
||||
|
||||
const retrieved = response.data;
|
||||
const retrieved = response.data as Workflow;
|
||||
|
||||
// Verify all expected fields are present
|
||||
expect(retrieved).toBeDefined();
|
||||
expect(retrieved.id).toBe(created.id);
|
||||
expect(retrieved.name).toBe(workflow.name);
|
||||
expect(retrieved.nodes).toBeDefined();
|
||||
expect(retrieved.nodes).toHaveLength(workflow.nodes.length);
|
||||
expect(retrieved.nodes).toHaveLength(workflow.nodes!.length);
|
||||
expect(retrieved.connections).toBeDefined();
|
||||
expect(retrieved.active).toBeDefined();
|
||||
expect(retrieved.createdAt).toBeDefined();
|
||||
@@ -78,7 +79,7 @@ describe('Integration: handleGetWorkflow', () => {
|
||||
|
||||
// Verify node data integrity
|
||||
const retrievedNode = retrieved.nodes[0];
|
||||
const originalNode = workflow.nodes[0];
|
||||
const originalNode = workflow.nodes![0];
|
||||
expect(retrievedNode.name).toBe(originalNode.name);
|
||||
expect(retrievedNode.type).toBe(originalNode.type);
|
||||
expect(retrievedNode.parameters).toBeDefined();
|
||||
|
||||
Reference in New Issue
Block a user