-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
460a13b
commit 49c5b0e
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var test = require('tape') | ||
var crypto = require('../') | ||
|
||
test('randomuuid', function (t) { | ||
var uuid1 = crypto.randomUUID() | ||
var uuid2 = crypto.randomUUID() | ||
|
||
t.ok(uuid1, 'first uuid truthy') | ||
t.ok(uuid2, 'second uuid truthy') | ||
|
||
t.notEqual(uuid1, uuid2, 'consecutive uuid\'s do not match') | ||
|
||
t.match(uuid1, /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 'first uuid matches uuid regex') | ||
t.match(uuid2, /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 'second uuid matches uuid regex') | ||
|
||
t.end() | ||
}) |