mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-14 04:37:50 +00:00
Add more _.uniq and _.matches tests.
This commit is contained in:
13
test/test.js
13
test/test.js
@@ -6680,6 +6680,15 @@
|
|||||||
strictEqual(matches(object), true);
|
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() {
|
test('should return `true` when comparing an empty `source`', 1, function() {
|
||||||
var object = { 'a': 1 },
|
var object = { 'a': 1 },
|
||||||
expected = _.map(empties, _.constant(true));
|
expected = _.map(empties, _.constant(true));
|
||||||
@@ -10604,6 +10613,10 @@
|
|||||||
deepEqual(_.uniq(array), [1, 2, 3]);
|
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() {
|
test('should work with `isSorted`', 1, function() {
|
||||||
var array = [1, 1, 2, 2, 3];
|
var array = [1, 1, 2, 2, 3];
|
||||||
deepEqual(_.uniq([1, 1, 2, 2, 3], true), [1, 2, 3]);
|
deepEqual(_.uniq([1, 1, 2, 2, 3], true), [1, 2, 3]);
|
||||||
|
|||||||
Reference in New Issue
Block a user