n8n/packages/workflow/test/errors/node.error.test.ts
कारतोफ्फेलस्क्रिप्ट™ b267bf07e3
fix(core): Prevent NodeErrors from being wrapped multiple times (#8301)
2024-01-16 16:18:34 +01:00

17 lines
629 B
TypeScript

import { mock } from 'jest-mock-extended';
import type { INode } from '@/Interfaces';
import { NodeApiError } from '@/errors/node-api.error';
import { NodeOperationError } from '@/errors/node-operation.error';
describe('NodeError', () => {
const node = mock<INode>();
it('should prevent errors from being re-wrapped', () => {
const apiError = new NodeApiError(node, mock({ message: 'Some error happened', code: 500 }));
const opsError = new NodeOperationError(node, mock());
expect(new NodeOperationError(node, apiError)).toEqual(apiError);
expect(new NodeOperationError(node, opsError)).toEqual(opsError);
});
});