Ensure _.concat casts non-array array values to arrays.

This commit is contained in:
John-David Dalton
2016-03-28 12:34:09 -07:00
parent 2ddd893ca2
commit a7bf3352df
2 changed files with 17 additions and 1 deletions

View File

@@ -3096,6 +3096,22 @@
assert.deepEqual(actual, expected);
});
QUnit.test('should cast non-array `array` values to arrays', function(assert) {
assert.expect(1);
var values = [true, false, 1, NaN, 'a'];
var expected = lodashStable.map(values, function(value) {
return [value, 2, [3]]
});
var actual = lodashStable.map(values, function(value) {
return _.concat(value, [2], [[3]]);
});
assert.deepEqual(actual, expected);
});
QUnit.test('should treat sparse arrays as dense', function(assert) {
assert.expect(3);