From d0333134d51c163bf781177450a385d5c304e568 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 8 Jul 2014 09:11:14 -0700 Subject: [PATCH] Add more `_.uniq` and `_.matches` tests. --- test/test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test.js b/test/test.js index 66932555a..a929dfbf3 100644 --- a/test/test.js +++ b/test/test.js @@ -6680,6 +6680,15 @@ strictEqual(matches(object), true); }); + test('should compare a variety of `source` object values', 2, function() { + var object = { 'a': false, 'b': true, 'c': '3', 'd': 4, 'e': [5], 'f': { 'g': 6 } }, + otherObject = _.assign({}, object, { 'a': false, 'c': 3, 'f': { 'g': '6' } }), + matches = _.matches(object); + + strictEqual(matches(object), true); + strictEqual(matches(otherObject), false); + }); + test('should return `true` when comparing an empty `source`', 1, function() { var object = { 'a': 1 }, expected = _.map(empties, _.constant(true)); @@ -10604,6 +10613,10 @@ deepEqual(_.uniq(array), [1, 2, 3]); }); + test('should treat object instances as uniq', 1, function() { + deepEqual(_.uniq(objects), objects); + }); + test('should work with `isSorted`', 1, function() { var array = [1, 1, 2, 2, 3]; deepEqual(_.uniq([1, 1, 2, 2, 3], true), [1, 2, 3]);