Ensure min and max of _.random are swapped if min > max.

This commit is contained in:
John-David Dalton
2015-12-21 20:10:46 -06:00
parent ad8628f8e7
commit 33da30266c
2 changed files with 36 additions and 18 deletions

View File

@@ -15407,6 +15407,20 @@
}));
});
QUnit.test('should swap `min` and `max` when `min` > `max`', function(assert) {
assert.expect(1);
var min = 4,
max = 2,
expected = [2, 3, 4];
var actual = lodashStable.uniq(lodashStable.map(array, function() {
return _.random(min, max);
})).sort();
assert.deepEqual(actual, expected);
});
QUnit.test('should support large integer values', function(assert) {
assert.expect(2);