Fix _.shuffle on small collections. [closes #609]

This commit is contained in:
John-David Dalton
2014-07-08 08:28:50 -07:00
parent 4ddc3b518b
commit b24b8315d3
2 changed files with 12 additions and 12 deletions

View File

@@ -8907,9 +8907,12 @@
deepEqual(_.shuffle(object).sort(), array);
});
test('should shuffle an object', 1, function() {
var actual = _.shuffle(object);
deepEqual(actual.sort(), array);
test('should shuffle small collections', 1, function() {
var actual = _.times(1000, function() {
return _.shuffle([1, 2]);
});
deepEqual(_.sortBy(_.uniq(actual, String), '0'), [[1, 2], [2, 1]]);
});
test('should treat number values for `collection` as empty', 1, function() {