From 4195c4c4bf108ed5d062c73d8881c34212a68e67 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sat, 4 Apr 2015 14:32:46 -0500 Subject: [PATCH] Add tests for missing `path` parts for `_.property` and `_.propertyOf`. --- test/test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test.js b/test/test.js index 89bf74786..36e394d0b 100644 --- a/test/test.js +++ b/test/test.js @@ -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); + }); }()); /*--------------------------------------------------------------------------*/