diff --git a/src/random.js b/src/random.js index b43e0b1f..774fbbf0 100644 --- a/src/random.js +++ b/src/random.js @@ -5,5 +5,5 @@ var uuid4 = require('uuid/v4') */ export default function random() { - return uuid4() + return uuid4().replace(/-/g, ''); } diff --git a/test/unit/random.spec.js b/test/unit/random.spec.js index ddb99eb5..050cb301 100644 --- a/test/unit/random.spec.js +++ b/test/unit/random.spec.js @@ -1,11 +1,13 @@ import random from '../../src/random' -const pattern = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/ +const pattern = /^[0-9a-f]{8}[0-9a-f]{4}4[0-9a-f]{3}[89ab][0-9a-f]{3}[0-9a-f]{12}$/ +//const pattern = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/ describe('random', function() { - it('should return a valid RFC4122 v4 guid', function(){ + it('should return a valid RFC4122 v4 guid (sans dashes)', function(){ const rnd = random() + console.log(rnd); rnd.should.match(pattern) }) })