Make _.uniqueId consistently return a string value.

Former-commit-id: 5a5c626df83b0fc78e9bae37510680383f112c0b
This commit is contained in:
John-David Dalton
2012-11-29 22:17:00 -08:00
parent 529c5b8abf
commit 619ba13265
7 changed files with 165 additions and 134 deletions

View File

@@ -1878,6 +1878,21 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.uniqueId');
(function() {
test('should return a string value when not passing a prefix argument', function() {
equal(typeof _.uniqueId(), 'string');
});
test('should coerce the prefix argument to a string', function() {
var actual = [_.uniqueId(3), _.uniqueId(2), _.uniqueId(1)];
equal(/3\d+,2\d+,1\d+/.test(actual), true);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.where');
(function() {