2017-11-01 08:40:43 +08:00
|
|
|
/* global describe, it */
|
|
|
|
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
const Generator = require('../../lib/key_generators/random');
|
|
|
|
|
2017-11-01 08:55:51 +08:00
|
|
|
describe('RandomKeyGenerator', () => {
|
|
|
|
describe('randomKey', () => {
|
|
|
|
it('should return a key of the proper length', () => {
|
|
|
|
const gen = new Generator();
|
2017-11-01 08:40:43 +08:00
|
|
|
assert.equal(6, gen.createKey(6).length);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should use a key from the given keyset if given', () => {
|
2017-11-01 08:55:51 +08:00
|
|
|
const gen = new Generator({keyspace: 'A'});
|
2017-11-01 08:40:43 +08:00
|
|
|
assert.equal('AAAAAA', gen.createKey(6));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|