From 139bc861b93bb919090b9318b4b81cee690ebffe Mon Sep 17 00:00:00 2001 From: MacLeod Broad <> Date: Sat, 21 Oct 2017 15:06:52 -0400 Subject: [PATCH] Adds tests for uuid --- test/uuid.test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/uuid.test.js diff --git a/test/uuid.test.js b/test/uuid.test.js new file mode 100644 index 00000000..7d5c1c04 --- /dev/null +++ b/test/uuid.test.js @@ -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) + }); + }); +});