Add empty path and array path coercing _.set test.

This commit is contained in:
jdalton
2015-04-06 12:04:07 -05:00
parent 2698e6f0ea
commit c066e655dc

View File

@@ -13256,6 +13256,22 @@
});
});
test('should not coerce array paths to strings', 1, function() {
var object = { 'a,b,c': 3, 'a': { 'b': { 'c': 3 } } };
_.set(object, ['a', 'b', 'c'], 4);
deepEqual(object, { 'a,b,c': 3, 'a': { 'b': { 'c': 4 } } });
});
test('should handle empty paths', 4, function() {
_.each([['', ''], [[], ['']]], function(paths, index) {
var object = {};
_.set(object, paths[0], 1);
deepEqual(object, index ? {} : { '': 1 });
_.set(object, paths[1], 2);
deepEqual(object, { '': 2 });
});
});
test('should create parts of `path` that are missing', 6, function() {
var object = {};