From d81e029ec07b67a3cd7554959a209c09859f1b88 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 6 Sep 2015 22:32:09 -0700 Subject: [PATCH] Add `_.isMatchWith` tests. --- test/test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test.js b/test/test.js index fe5ed11ef..1820a325e 100644 --- a/test/test.js +++ b/test/test.js @@ -7613,6 +7613,24 @@ strictEqual(_.isMatchWith({ 'a': 1 }, { 'a': 1 }, _.noop), true); }); + test('should not handle comparisons if `customizer` returns `true`', 2, function() { + var customizer = function(value) { + return _.isString(value) || undefined; + }; + + strictEqual(_.isMatchWith(['a'], ['b'], customizer), true); + strictEqual(_.isMatchWith({ '0': 'a' }, { '0': 'b' }, customizer), true); + }); + + test('should not handle comparisons if `customizer` returns `false`', 2, function() { + var customizer = function(value) { + return _.isString(value) ? false : undefined; + }; + + strictEqual(_.isMatchWith(['a'], ['a'], customizer), false); + strictEqual(_.isMatchWith({ '0': 'a' }, { '0': 'a' }, customizer), false); + }); + test('should return a boolean value even if `customizer` does not', 2, function() { var object = { 'a': 1 }, actual = _.isMatchWith(object, { 'a': 1 }, _.constant('a'));