Skip to content

Commit

Permalink
Failing test for a clone array case
Browse files Browse the repository at this point in the history
  • Loading branch information
TehShrike authored and aretecode committed Jun 23, 2017
1 parent 4c05e25 commit 836222e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,18 @@ test('should clone array\'s element if it is object', function(t) {
t.equal(output[0].key, 'yup')
t.end()
})

test('should clone an array property when there is no target array', function(t) {
const someObject = {}
var target = {}
var source = { ary: [someObject]}
var output = merge(target, source, { clone: true })

t.deepEqual(output, { ary: [{}] })
t.notEqual(output.ary[0], someObject)
t.end()
})

test('should overwrite values when property is initialised but undefined', function(t) {
var target1 = { value: [] }
var target2 = { value: null }
Expand Down

0 comments on commit 836222e

Please sign in to comment.