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