fix: resolve TypeScript errors in MCP handler tests
- Fix N8nRateLimitError constructor call (takes only retryAfter parameter) - Fix optional chaining for result.details access - Mock NodeRepository correctly instead of trying to instantiate it 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -453,7 +453,7 @@ describe('handlers-n8n-manager', () => {
|
||||
describe('handleValidateWorkflow', () => {
|
||||
it('should validate workflow from n8n instance', async () => {
|
||||
const testWorkflow = createTestWorkflow();
|
||||
const mockNodeRepository = new NodeRepository(':memory:');
|
||||
const mockNodeRepository = {} as any; // Mock repository
|
||||
|
||||
mockApiClient.getWorkflow.mockResolvedValue(testWorkflow);
|
||||
mockValidator.validateWorkflow.mockResolvedValue({
|
||||
@@ -614,7 +614,7 @@ describe('handlers-n8n-manager', () => {
|
||||
});
|
||||
|
||||
it('should handle rate limit errors', async () => {
|
||||
const rateLimitError = new N8nRateLimitError('Too many requests', 60);
|
||||
const rateLimitError = new N8nRateLimitError(60);
|
||||
mockApiClient.listWorkflows.mockRejectedValue(rateLimitError);
|
||||
|
||||
const result = await handlers.handleListWorkflows({});
|
||||
|
||||
@@ -351,7 +351,7 @@ describe('handlers-workflow-diff', () => {
|
||||
expect(result.success).toBe(false);
|
||||
expect(result.error).toBe('Invalid input');
|
||||
expect(result.details).toHaveProperty('errors');
|
||||
expect(result.details.errors).toBeInstanceOf(Array);
|
||||
expect(result.details?.errors).toBeInstanceOf(Array);
|
||||
});
|
||||
|
||||
it('should handle complex operation types', async () => {
|
||||
@@ -462,7 +462,7 @@ describe('handlers-workflow-diff', () => {
|
||||
});
|
||||
|
||||
it('should handle rate limit errors', async () => {
|
||||
const rateLimitError = new N8nRateLimitError('Too many requests', 60);
|
||||
const rateLimitError = new N8nRateLimitError(60);
|
||||
mockApiClient.getWorkflow.mockRejectedValue(rateLimitError);
|
||||
|
||||
const result = await handleUpdatePartialWorkflow({
|
||||
|
||||
Reference in New Issue
Block a user