Skip to content

Commit

Permalink
Few more array-overwrites-everything tests for super-defensiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
TehShrike committed Oct 12, 2016
1 parent 0145d49 commit befc599
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,40 @@ test('should replace objects with arrays', function(t) {
t.end()
})

test('should replace dates with arrays', function(t) {
var target = [
{ key1: new Date()}
]

var src = [
{ key1: [ "subkey" ]}
]

var expected = [
{ key1: [ "subkey" ]}
]

t.deepEqual(merge(target, src), expected)
t.end()
})

test('should replace null with arrays', function(t) {
var target = {
key1: null
}

var src = {
key1: [ "subkey" ]
}

var expected = {
key1: [ "subkey" ]
}

t.deepEqual(merge(target, src), expected)
t.end()
})

test('should work on simple array', function (t) {
var src = ['one', 'three']
var target = ['one', 'two']
Expand Down

0 comments on commit befc599

Please sign in to comment.