From 4cd26e6860bc0958d15c8468f98e31fff10ace5e Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 27 Aug 2016 19:17:11 -0700 Subject: [PATCH] =?UTF-8?q?Add=20more=20=E2=80=9C=5F=5Fproto=5F=5F?= =?UTF-8?q?=E2=80=9D=20assignment=20tests.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index e004c3af8..b05e46e8b 100644 --- a/test/test.js +++ b/test/test.js @@ -7473,9 +7473,29 @@ }); QUnit.test('should treat "__proto__" as a regular key in assignments', function(assert) { - assert.expect(1); + assert.expect(2); - var actual = _.groupBy([{ 'a': '__proto__' }], 'a'); + var methods = [ + 'assign', + 'assignIn', + 'defaults', + 'defaultsDeep', + 'merge' + ]; + + var source = create(null); + source.__proto__ = []; + + var expected = lodashStable.map(methods, stubFalse); + + var actual = lodashStable.map(methods, function(methodName) { + var result = _[methodName]({}, source); + return result instanceof Array; + }); + + assert.deepEqual(actual, expected); + + actual = _.groupBy([{ 'a': '__proto__' }], 'a'); assert.notOk(actual instanceof Array); }); }());