Browse Source

Adds tests for uuid

mbroad/unittest/lib/shared
MacLeod Broad 7 years ago
parent
commit
139bc861b9
No known key found for this signature in database GPG Key ID: F1B295D13C3CC9CF
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      test/uuid.test.js

+ 19
- 0
test/uuid.test.js View File

@ -0,0 +1,19 @@
var assert = require('assert');
var uuid = require('../lib/module/uuid');
describe('UUID', function () {
describe('v1', function () {
it('generates valid, parseable uuid1', function () {
assert(/^[0-9A-F]{8}-[0-9A-F]{4}-[1][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i.test(uuid.v1()));
assert.equal(uuid.parse(uuid.v1()).length, 16)
});
});
describe('v4', function () {
it('generates valid, parseable uuid4', function () {
assert(/^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i.test(uuid.v4()));
assert.equal(uuid.parse(uuid.v4()).length, 16)
});
});
});

Loading…
Cancel
Save