1
0
mirror of https://github.com/S2-/securerandomstring.git synced 2025-08-03 02:40:04 +02:00

remove useless urlsafe: false option

This commit is contained in:
s2
2015-08-27 23:37:05 +02:00
parent 9a72a2cfe2
commit 645d64b940
3 changed files with 6 additions and 25 deletions

View File

@@ -50,28 +50,15 @@ srs({length: 256}, function(err, sr) {
);
});
srs({length: 256}, function(err, sr) {
test('generate a urlsafe random string 256 chars long',
sr.length,
256
);
});
// sync tests
test('generate a random string 32 chars long (sync)', srs().length, 32);
test('generate a random string 1 chars long (sync)', srs({length:1}).length, 1);
test('generate a random string 256 chars long (sync)', srs({length:256}).length, 256);
test('generate a urlsafe random string 256 chars long (sync)', srs({length:256}).length, 256);
//when generating, the default should be urlsafe
//in 2000 chars there should be at least one substitution
test('check that the random string is urlsafe by default', (function() {
test('check that the random string is urlsafe', (function() {
var s = srs({length: 2000});
return s.indexOf('+') + s.indexOf('/') === -2;
})(), true);
test('check that the useless urlsafe: false option works', (function() {
var s = srs({length: 2000, urlsafe: false});
return s.indexOf('_') + s.indexOf('-') === -2;
})(), true);