From c88589e0e5f1ec896f415b08d2e47fa37197613e Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 3 Apr 2015 12:55:42 -0500 Subject: [PATCH] Add `_.result` tests for deep paths. --- test/test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test.js b/test/test.js index 0e1e3e789..d5a10217d 100644 --- a/test/test.js +++ b/test/test.js @@ -12610,6 +12610,16 @@ strictEqual(_.result(object, 'd'), undefined); }); + test('should get deep property values', 1, function() { + var object = { 'a': { 'b': { 'c': 3 } } }; + strictEqual(_.result(object, 'a.b.c'), 3); + }); + + test('should get a key before treating it as a path', 1, function() { + var object = { 'a.b.c': 3, 'a': { 'b': { 'c': 4 } } }; + strictEqual(_.result(object, 'a.b.c'), 3); + }); + test('should return `undefined` when `object` is nullish', 2, function() { strictEqual(_.result(null, 'a'), undefined); strictEqual(_.result(undefined, 'a'), undefined);