Skip to content

Commit

Permalink
Make IDs *always* 16 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
michelle-stripe committed May 2, 2014
1 parent 8f513df commit 9b3f7a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var util = {
return dest;
},
randomId: function () {
return Math.random().toString(36).substr(2);
return (Math.random().toString(36) + '0000000000000000000').substr(2, 16);
},
prettyError: function (msg) {
if (util.debug) {
Expand Down
2 changes: 1 addition & 1 deletion test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ describe('PeerServer', 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);
});
});
});

0 comments on commit 9b3f7a3

Please sign in to comment.