mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(core): Remove circular refs from Code and push msg (#5741)
* remove circular refs from code items (and lint fixes) * cleanup --------- * add some tests Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
committed by
GitHub
parent
199a91b398
commit
b6d8a0f985
@@ -1,4 +1,4 @@
|
||||
import { jsonParse, deepCopy } from '@/utils';
|
||||
import { jsonParse, jsonStringify, deepCopy } from '@/utils';
|
||||
|
||||
describe('jsonParse', () => {
|
||||
it('parses JSON', () => {
|
||||
@@ -17,6 +17,21 @@ describe('jsonParse', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('jsonStringify', () => {
|
||||
const source: any = { a: 1, b: 2 };
|
||||
source.c = source;
|
||||
|
||||
it('should throw errors on circular references by default', () => {
|
||||
expect(() => jsonStringify(source)).toThrow('Converting circular structure to JSON');
|
||||
});
|
||||
|
||||
it('should break circular references when requested', () => {
|
||||
expect(jsonStringify(source, { replaceCircularRefs: true })).toEqual(
|
||||
'{"a":1,"b":2,"c":"[Circular Reference]"}',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('deepCopy', () => {
|
||||
it('should deep copy an object', () => {
|
||||
const serializable = {
|
||||
|
||||
Reference in New Issue
Block a user