mirror of
https://github.com/toptal/haste-server.git
synced 2024-11-24 06:20:14 -08:00
cb4809195b
* Improve tests This PR adds some necessary tests, fixes the naming on describe (everything was set to RandomKeyGenerator, perhaps a copy/paste exception) and fixes the consonant/vowel alternation test, since it was failing if the keyspace started with a vowel. * Remove unecessary file
25 lines
713 B
JavaScript
25 lines
713 B
JavaScript
/* global describe, it */
|
|
|
|
const assert = require('assert');
|
|
|
|
const Generator = require('../../lib/key_generators/random');
|
|
|
|
describe('RandomKeyGenerator', () => {
|
|
describe('generation', () => {
|
|
it('should return a key of the proper length', () => {
|
|
const gen = new Generator();
|
|
assert.equal(gen.createKey(6).length, 6);
|
|
});
|
|
|
|
it('should use a key from the given keyset if given', () => {
|
|
const gen = new Generator({keyspace: 'A'});
|
|
assert.equal(gen.createKey(6), 'AAAAAA');
|
|
});
|
|
|
|
it('should not use a key from the given keyset if not given', () => {
|
|
const gen = new Generator({keyspace: 'A'});
|
|
assert.ok(!gen.createKey(6).includes('B'));
|
|
});
|
|
});
|
|
});
|