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

24 lines
613 B
JavaScript
Raw Normal View History

/* global describe, it */
const assert = require('assert');
const Generator = require('../../lib/key_generators/phonetic');
describe('KeyGenerator', () => {
describe('phonetic', () => {
2020-08-28 23:57:50 +02:00
it('should return a key of the proper length', () => {
const gen = new Generator();
assert.strictEqual(6, gen.createKey(6).length);
2020-08-28 23:57:50 +02:00
});
2020-08-28 23:57:50 +02:00
it('should alternate consonants and vowels', () => {
const gen = new Generator();
const vowels = 'aeiouy';
2020-08-28 23:57:50 +02:00
const key = gen.createKey(3);
if (vowels.includes(key[0])) assert.ok(vowels.includes(key[2]));
else assert.ok(vowels.includes(key[1]));
2020-08-28 23:57:50 +02:00
});
});
});