-
-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Description
Suggestion
adding a test like this
test(`can merge circular object`, t => {
const x = {
a: { b: { c: `value1`, e: `im x`} },
} as any
x.a.b.a = x.a
x.a.b.b = x.a
const y = {
a: { b: { c: `value2`, d: `val2` } },
b: { b: { c: `value2`, d: `im y` } },
} as any
y.b.b.b = y.b
y.b.b.c = y.b
const expected = {
a: {
b: {
a: x.a,
b: x.a,
c: `value2`,
d: `val2`,
e: `im x`,
},
},
b: {
b: {
b: y.b,
c: y.b,
d: `im y`,
},
},
}
const merged = deepmerge(x, y)
t.deepEqual(merged, expected)
t.true(merged.a.b.a === merged.a)
t.true(merged.a.b.b === merged.a)
})there is some reason I cant test it myself on my desktop.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels