mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(editor): Add missing extension methods for expressions (#8845)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
|
||||
import { arrayExtensions } from '../../src/Extensions/ArrayExtensions';
|
||||
import { evaluate } from './Helpers';
|
||||
|
||||
describe('Data Transformation Functions', () => {
|
||||
@@ -234,5 +235,27 @@ describe('Data Transformation Functions', () => {
|
||||
[16, 17, 18, 19, 20],
|
||||
]);
|
||||
});
|
||||
|
||||
test('.toJsonString() should work on an array', () => {
|
||||
expect(evaluate('={{ [true, 1, "one", {foo: "bar"}].toJsonString() }}')).toEqual(
|
||||
'[true,1,"one",{"foo":"bar"}]',
|
||||
);
|
||||
});
|
||||
|
||||
describe('Conversion methods', () => {
|
||||
test('should exist but return undefined (to not break expressions with mixed data)', () => {
|
||||
expect(evaluate('={{ numberList(1, 20).toInt() }}')).toBeUndefined();
|
||||
expect(evaluate('={{ numberList(1, 20).toFloat() }}')).toBeUndefined();
|
||||
expect(evaluate('={{ numberList(1, 20).toBoolean() }}')).toBeUndefined();
|
||||
expect(evaluate('={{ numberList(1, 20).toDateTime() }}')).toBeUndefined();
|
||||
});
|
||||
|
||||
test('should not have a doc (hidden from autocomplete)', () => {
|
||||
expect(arrayExtensions.functions.toInt.doc).toBeUndefined();
|
||||
expect(arrayExtensions.functions.toFloat.doc).toBeUndefined();
|
||||
expect(arrayExtensions.functions.toBoolean.doc).toBeUndefined();
|
||||
expect(arrayExtensions.functions.toDateTime.doc).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user