import { mergeDeep } from '../src/json-utils/merge-deep'; describe('Deep merge utility', () => { it('Merges simple objects', () => { const x = { a: 10, b: 20 }, y = { c: 30, d: 40 }, z = { e: 50 }, expectedOutput = { a: 10, b: 20, c: 30, d: 40, e: 50 }, output = mergeDeep(x, y, z); expect(JSON.stringify(output)).toBe(JSON.stringify(expectedOutput)); }); it('Merges objects with arrays', () => { const x = { a: 'Hello', foo: { bar: 100 } }, y = { b: 'Heya', foo: { baz: 20 }, e: [10, 20, 30] }, z = { b: 'Hey', foo: { bar: 10, qux: 30 }, e: [40, 50, 60] }, expectedOutput = { a: 'Hello', foo: { bar: 10, baz: 20, qux: 30 }, b: 'Hey', e: [10, 20, 30, 40, 50, 60] }, output = mergeDeep(x, y, z); expect(JSON.stringify(output)).toBe(JSON.stringify(expectedOutput)); }); });