Skip to content

Commit

Permalink
Add test for unaltered branches in mergeDeep()
Browse files Browse the repository at this point in the history
  • Loading branch information
guigrpa committed Oct 25, 2017
1 parent aaf912a commit 32c25e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,11 @@ test("merge: multiple: should return the same object when it hasn't changed", t
// mergeDeep()
//------------------------------------------------
test('mergeDeep: should merge deeply', t => {
const obj2 = timm.mergeDeep({ a: 1, b: { a: 1, b: 2 } }, { b: { b: 3 } });
t.deepEqual(obj2, { a: 1, b: { a: 1, b: 3 } });
const obj1 = { a: 1, b: { a: 1, b: 2, obj: { foo: 3 } }, c: { c1: 8 } };
const obj2 = timm.mergeDeep(obj1, { b: { b: 3 } });
t.deepEqual(obj2, { a: 1, b: { a: 1, b: 3, obj: { foo: 3 } }, c: { c1: 8 } });
t.is(obj1.b.obj, obj2.b.obj); // unaltered branch
t.is(obj1.c, obj2.c); // unaltered branch
});

test('mergeDeep: multiple: should merge deeply', t => {
Expand Down

0 comments on commit 32c25e5

Please sign in to comment.