mirror of
https://github.com/S2-/securerandomstring.git
synced 2025-08-02 10:20:05 +02:00
add one more test
This commit is contained in:
8
tests.js
8
tests.js
@@ -56,6 +56,14 @@ srs({alphanumeric: true}, function(err, sr) {;
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
srs({alphanumeric: true, length: 40}, function(err, sr) {;
|
||||||
|
test('Must contain alphanumeric only and be 40 chars long',
|
||||||
|
sr.match(/^[a-zA-Z0-9_]*$/g)[0] === sr && sr.length === 40,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// sync tests
|
// sync tests
|
||||||
test('generate a random string 32 chars long (sync)', srs().length, 32);
|
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 1 chars long (sync)', srs({length: 1}).length, 1);
|
||||||
|
Reference in New Issue
Block a user