From 642d248f997b6a3531fd436dd76b335f25639cd0 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 31 Mar 2016 19:08:43 -0700 Subject: [PATCH] Cleanup deep property tests of `has` methods. --- test/test.js | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/test/test.js b/test/test.js index 032699be4..c1c63bf4b 100644 --- a/test/test.js +++ b/test/test.js @@ -7275,22 +7275,7 @@ }); }); - QUnit.test('`_.' + methodName + '` should return `false` when nested `object` is nullish', function(assert) { - assert.expect(2); - - var values = [null, undefined], - expected = lodashStable.map(values, alwaysFalse); - - lodashStable.each(['a.b.c', ['a', 'b', 'c']], function(path) { - var actual = lodashStable.map(values, function(value) { - return func({ 'a': value }, path); - }); - - assert.deepEqual(actual, expected); - }); - }); - - QUnit.test('`_.' + methodName + '` should return `false` with deep paths when `object` is nullish', function(assert) { + QUnit.test('`_.' + methodName + '` should return `false` for deep paths when `object` is nullish', function(assert) { assert.expect(2); var values = [null, undefined], @@ -7305,13 +7290,19 @@ }); }); - QUnit.test('`_.' + methodName + '` should return `false` if parts of `path` are missing', function(assert) { - assert.expect(4); + QUnit.test('`_.' + methodName + '` should return `false` for nested nullish values', function(assert) { + assert.expect(2); - var object = {}; + var values = [, null, undefined], + expected = lodashStable.map(values, alwaysFalse); - lodashStable.each(['a', 'a[1].b.c', ['a'], ['a', '1', 'b', 'c']], function(path) { - assert.strictEqual(func(object, path), false); + lodashStable.each(['a.b.c', ['a', 'b', 'c']], function(path) { + var actual = lodashStable.map(values, function(value, index) { + var object = index ? { 'a': value } : {}; + return func(object, path); + }); + + assert.deepEqual(actual, expected); }); }); });