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

Add support for 'sync' API. Updates code, tests and docs.

This commit is contained in:
Mark Stosberg
2015-08-06 12:06:40 -04:00
parent 350fd45086
commit a1cab50548
4 changed files with 52 additions and 21 deletions

View File

@@ -28,7 +28,7 @@ var test = function(name, what, ref, c) {
//the actual tests
// async tests
srs(function(sr) {
test('generate a random string 32 chars long',
sr.length,
@@ -58,3 +58,8 @@ srs({length: 256, urlsafe: true}, function(sr) {
});
// 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, urlsafe:true}).length, 256);