Add tests for missing path parts for _.property and _.propertyOf.

This commit is contained in:
jdalton
2015-04-04 14:32:46 -05:00
parent 13e7a1ed93
commit 4195c4c4bf

View File

@@ -11748,6 +11748,16 @@
deepEqual(actual, expected);
});
test('should return `undefined` if parts of `path` are missing', 2, function() {
var object = {},
prop = _.property('a');
strictEqual(prop(object), undefined);
prop = _.property('a[1].b.c');
strictEqual(prop(object), undefined);
});
}());
/*--------------------------------------------------------------------------*/
@@ -11810,6 +11820,14 @@
deepEqual(actual, expected);
});
test('should return `undefined` if parts of `path` are missing', 2, function() {
var object = {},
propOf = _.propertyOf(object);
strictEqual(propOf('a'), undefined);
strictEqual(propOf('a[1].b.c'), undefined);
});
}());
/*--------------------------------------------------------------------------*/