A fork of https://github.com/ueokande/vim-vixen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
704 B
25 lines
704 B
7 years ago
|
import HintKeyProducer from 'content/hint-key-producer';
|
||
7 years ago
|
|
||
|
describe('HintKeyProducer class', () => {
|
||
|
describe('#constructor', () => {
|
||
|
it('throws an exception on empty charset', () => {
|
||
|
expect(() => new HintKeyProducer([])).to.throw(TypeError);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
describe('#produce', () => {
|
||
|
it('produce incremented keys', () => {
|
||
|
let charset = 'abc';
|
||
|
let sequences = [
|
||
|
'a', 'b', 'c',
|
||
|
'aa', 'ab', 'ac', 'ba', 'bb', 'bc', 'ca', 'cb', 'cc',
|
||
|
'aaa', 'aab', 'aac', 'aba']
|
||
|
|
||
|
let producer = new HintKeyProducer(charset);
|
||
|
for (let i = 0; i < sequences.length; ++i) {
|
||
|
expect(producer.produce()).to.equal(sequences[i]);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|