From 003d6ec43fd888f0b42f2c10589cc497e077f2e7 Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 3 Apr 2015 17:08:30 -0500 Subject: [PATCH] Add `_.has` tests for deep paths. --- test/test.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index 7b3c8fa00..b36f54c24 100644 --- a/test/test.js +++ b/test/test.js @@ -6152,7 +6152,17 @@ strictEqual(_.has(object, 'a'), true); }); - test('should not check for inherited properties', 1, function() { + test('should support deep paths', 1, function() { + var object = { 'a': { 'b': { 'c': 3 } } }; + strictEqual(_.has(object, 'a.b.c'), true); + }); + + test('should check for a key over a path', 1, function() { + var object = { 'a.b.c': 3, 'a': { 'b': {} } }; + strictEqual(_.has(object, 'a.b.c'), true); + }); + + test('should return `false` for inherited properties', 1, function() { function Foo() {} Foo.prototype.a = 1;