From 997c43bbdde068385bbf11d80210a7dc0adf36d9 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 13 Feb 2013 02:49:12 -0800 Subject: [PATCH] Add `_.extend` and `_.defaults` `underscore` build tests. Former-commit-id: f9244ddd7c81f65d2f0a01a18fa6e821e8f2705b --- test/test-build.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test-build.js b/test/test-build.js index f46746912..32ce035c1 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -763,9 +763,18 @@ function Foo() {} Foo.prototype = { 'a': 1 }; + actual = lodash.defaults({ 'a': null }, { 'a': 1 }); + strictEqual(actual.a, 1, '_.defaults should overwrite `null` values: ' + basename); + deepEqual(lodash.defaults({}, new Foo), Foo.prototype, '_.defaults should assign inherited `source` properties: ' + basename); deepEqual(lodash.extend({}, new Foo), Foo.prototype, '_.extend should assign inherited `source` properties: ' + basename); + actual = lodash.extend({}, { 'a': 0 }, function(a, b) { + return this[b]; + }, [2]); + + strictEqual(actual.a, 0, '_.extend should ignore `callback` and `thisArg`: ' + basename); + actual = lodash.find(array, function(value) { return 'a' in value; });