-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(editor): Render dates correctly in parameter hint (#9089)
- Loading branch information
Showing
4 changed files
with
72 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/editor-ui/src/utils/__tests__/expressions.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ExpressionError } from 'n8n-workflow'; | ||
import { stringifyExpressionResult } from '../expressions'; | ||
|
||
describe('stringifyExpressionResult()', () => { | ||
it('should return empty string for non-critical errors', () => { | ||
expect( | ||
stringifyExpressionResult({ | ||
ok: false, | ||
error: new ExpressionError('error message', { type: 'no_execution_data' }), | ||
}), | ||
).toEqual(''); | ||
}); | ||
|
||
it('should return an error message for critical errors', () => { | ||
expect( | ||
stringifyExpressionResult({ | ||
ok: false, | ||
error: new ExpressionError('error message', { type: 'no_input_connection' }), | ||
}), | ||
).toEqual('[ERROR: No input connected]'); | ||
}); | ||
|
||
it('should return empty string when result is null', () => { | ||
expect(stringifyExpressionResult({ ok: true, result: null })).toEqual(''); | ||
}); | ||
|
||
it('should return [empty] message when result is empty string', () => { | ||
expect(stringifyExpressionResult({ ok: true, result: '' })).toEqual('[empty]'); | ||
}); | ||
|
||
it('should return the result when it is a string', () => { | ||
expect(stringifyExpressionResult({ ok: true, result: 'foo' })).toEqual('foo'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters