Make IDs *always* 16 characters

This commit is contained in:
Michelle Bu 2014-05-01 21:05:11 -07:00
parent 8f513dfe3c
commit 9b3f7a3f38
2 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ var util = {
return dest; return dest;
}, },
randomId: function () { randomId: function () {
return Math.random().toString(36).substr(2); return (Math.random().toString(36) + '0000000000000000000').substr(2, 16);
}, },
prettyError: function (msg) { prettyError: function (msg) {
if (util.debug) { if (util.debug) {

View File

@ -206,7 +206,7 @@ describe('PeerServer', function() {
}); });
it('should generate a 16-character ID', function() { it('should generate a 16-character ID', function() {
expect(p._generateClientId('anykey').length).to.be.within(15, 16); expect(p._generateClientId('anykey').length).to.be(16);
}); });
}); });
}); });