1
0
Fork 0
mirror of https://github.com/SunRed/haste-server.git synced 2024-11-27 19:30:19 +01:00
haste-server/test/key_generators/random_spec.js

20 lines
529 B
JavaScript
Raw Normal View History

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