feat(editor): Remove AI Error Debugging (#9337)

This commit is contained in:
Milorad FIlipović
2024-05-08 14:13:47 +02:00
committed by GitHub
parent f64a41d617
commit cda062bde6
14 changed files with 5 additions and 356 deletions

View File

@@ -1,42 +0,0 @@
import { Container } from 'typedi';
import { mock } from 'jest-mock-extended';
import { mockInstance } from '../../shared/mocking';
import { AIService } from '@/services/ai.service';
import { AIController } from '@/controllers/ai.controller';
import type { AIRequest } from '@/requests';
import type { INode, INodeType } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';
import { NodeTypes } from '@/NodeTypes';
describe('AIController', () => {
const aiService = mockInstance(AIService);
const nodeTypesService = mockInstance(NodeTypes);
const controller = Container.get(AIController);
describe('debugError', () => {
it('should retrieve nodeType based on error and call aiService.debugError', async () => {
const nodeType = {
description: {},
} as INodeType;
const error = new NodeOperationError(
{
type: 'n8n-nodes-base.error',
typeVersion: 1,
} as INode,
'Error message',
);
const req = mock<AIRequest.DebugError>({
body: {
error,
},
});
nodeTypesService.getByNameAndVersion.mockReturnValue(nodeType);
await controller.debugError(req);
expect(aiService.debugError).toHaveBeenCalledWith(error, nodeType);
});
});
});