Convert random generator to es6 and add some specs for it directly

This commit is contained in:
John Crepezzi 2017-10-31 20:40:43 -04:00
parent e12805a8aa
commit e4e025f67e
3 changed files with 37 additions and 17 deletions

View file

@ -0,0 +1,19 @@
/* global describe, it */
const assert = require('assert');
const Generator = require('../../lib/key_generators/random');
describe('RandomKeyGenerator', function() {
describe('randomKey', function() {
it('should return a key of the proper length', function() {
var gen = new Generator();
assert.equal(6, gen.createKey(6).length);
});
it('should use a key from the given keyset if given', () => {
var gen = new Generator({keyspace: 'A'});
assert.equal('AAAAAA', gen.createKey(6));
});
});
});