1
0
Fork 0
mirror of https://github.com/SunRed/haste-server.git synced 2024-11-24 02:00:17 +01:00
haste-server/test/key_generators/phonetic_spec.js

28 lines
669 B
JavaScript
Raw Normal View History

/* global describe, it */
const assert = require('assert');
const Generator = require('../../lib/key_generators/phonetic');
const vowels = 'aeiou';
const consonants = 'bcdfghjklmnpqrstvwxyz';
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);
});
2020-08-28 23:57:50 +02:00
it('should alternate consonants and vowels', () => {
const gen = new Generator();
2020-08-28 23:57:50 +02:00
const key = gen.createKey(3);
2020-08-28 23:57:50 +02:00
assert.ok(consonants.includes(key[0]));
assert.ok(consonants.includes(key[2]));
assert.ok(vowels.includes(key[1]));
});
});
});