Add a test for _.uniq with isSorted.

This commit is contained in:
John-David Dalton
2014-02-22 19:20:14 -08:00
parent 6448e049d1
commit 054be39feb

View File

@@ -8459,18 +8459,9 @@
deepEqual(_.uniq(array), [1, 2, 3]);
});
test('should work with large arrays', 1, function() {
var object = {};
var largeArray = _.times(LARGE_ARRAY_SIZE, function(index) {
switch (index % 3) {
case 0: return 0;
case 1: return 'a';
case 2: return object;
}
});
deepEqual(_.uniq(largeArray), [0, 'a', object]);
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]);
});
test('should work with a callback', 1, function() {
@@ -8504,6 +8495,20 @@
deepEqual(actual, [[2, 1], [1, 2]]);
});
test('should work with large arrays', 1, function() {
var object = {};
var largeArray = _.times(LARGE_ARRAY_SIZE, function(index) {
switch (index % 3) {
case 0: return 0;
case 1: return 'a';
case 2: return object;
}
});
deepEqual(_.uniq(largeArray), [0, 'a', object]);
});
test('should work with large arrays of boolean, `null`, and `undefined` values', 1, function() {
var array = [],
expected = [true, false, null, undefined],