From 18481a40b295f9034aebf6d1008f49533860a156 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 28 Dec 2015 11:11:20 -0600 Subject: [PATCH] Add `_.has` and `_.hasIn` tests for `arguments` objects and strings. --- test/test.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index b7f35817c..febed7646 100644 --- a/test/test.js +++ b/test/test.js @@ -6383,10 +6383,22 @@ }); }); - QUnit.test('`_.' + methodName + '` should treat sparse arrays as dense', function(assert) { + QUnit.test('`_.' + methodName + '` should return `true` for index values within bounds for arrays, `arguments` objects, and strings', function(assert) { assert.expect(1); - assert.strictEqual(func(Array(1), 0), true); + var string = Object('abc'); + delete args[0]; + delete string[0]; + + var values = [Array(3), args, string], + expected = lodashStable.map(values, lodashStable.constant(true)); + + var actual = lodashStable.map(values, function(value) { + return func(value, 0); + }); + + assert.deepEqual(actual, expected); + args[0] = 1; }); QUnit.test('`_.' + methodName + '` should check for a key over a path', function(assert) {