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.
26 lines
745 B
26 lines
745 B
7 years ago
|
import { expect } from "chai";
|
||
|
import HintKeyProducer from '../../src/content/hint-key-producer';
|
||
|
|
||
|
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]);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|