mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-13 16:14:07 -08:00
17 lines
629 B
TypeScript
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);
|
|
});
|
|
});
|