mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(editor): Add toJsonString to string extensions (#13798)
This commit is contained in:
@@ -313,6 +313,14 @@ describe('Data Transformation Functions', () => {
|
||||
expect(() => evaluate('={{ "No JSON here".parseJson() }}')).toThrowError('Parsing failed');
|
||||
});
|
||||
|
||||
test('.toJsonString should work on a string', () => {
|
||||
expect(evaluate('={{ "test".toJsonString() }}')).toEqual(JSON.stringify('test'));
|
||||
expect(evaluate('={{ "The \\"best\\" colours: red\\nbrown".toJsonString() }}')).toEqual(
|
||||
JSON.stringify('The "best" colours: red\nbrown'),
|
||||
);
|
||||
expect(evaluate('={{ "".toJsonString() }}')).toEqual(JSON.stringify(''));
|
||||
});
|
||||
|
||||
test('.toBoolean should work on a string', () => {
|
||||
expect(evaluate('={{ "False".toBoolean() }}')).toBe(false);
|
||||
expect(evaluate('={{ "".toBoolean() }}')).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user