Files
n8n/packages/@n8n/utils/src/errors/get-error-message.test.ts
T
60de10030b chore: Extract the duplicated getErrorMessage helper in the instance-ai module into @n8n/utils (#37724)
Co-authored-by: n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-03 10:23:13 +00:00

20 lines
601 B
TypeScript

import { getErrorMessage } from './get-error-message';
describe('getErrorMessage', () => {
it('returns the message of an Error instance', () => {
expect(getErrorMessage(new Error('original error'))).toBe('original error');
});
it('returns a string unchanged', () => {
expect(getErrorMessage('something went wrong')).toBe('something went wrong');
});
it('returns the string form of an object', () => {
expect(getErrorMessage({ code: 42 })).toBe('[object Object]');
});
it('returns the string form of undefined', () => {
expect(getErrorMessage(undefined)).toBe('undefined');
});
});