mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
31 lines
982 B
TypeScript
31 lines
982 B
TypeScript
import { parseErrorMetadata } from '@/MetadataUtils';
|
|
|
|
describe('MetadataUtils', () => {
|
|
describe('parseMetadataFromError', () => {
|
|
it('should return undefined if error does not have response', () => {
|
|
const error = { message: 'An error occurred' };
|
|
const result = parseErrorMetadata(error);
|
|
expect(result).toBeUndefined();
|
|
});
|
|
|
|
it('should return undefined if error response does not have subworkflow data', () => {
|
|
const error = { errorResponse: { someKey: 'someValue' } };
|
|
const result = parseErrorMetadata(error);
|
|
expect(result).toBeUndefined();
|
|
});
|
|
|
|
it('should return metadata if error response has subworkflow data', () => {
|
|
const error = { errorResponse: { executionId: '123', workflowId: '456' } };
|
|
const expectedMetadata = {
|
|
subExecution: {
|
|
executionId: '123',
|
|
workflowId: '456',
|
|
},
|
|
subExecutionsCount: 1,
|
|
};
|
|
const result = parseErrorMetadata(error);
|
|
expect(result).toEqual(expectedMetadata);
|
|
});
|
|
});
|
|
});
|