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
755 B
26 lines
755 B
6 years ago
|
import HintKeyProducer from '../../../src/content/usecases/HintKeyProducer';
|
||
|
import { expect } from 'chai';
|
||
7 years ago
|
|
||
|
describe('HintKeyProducer class', () => {
|
||
|
describe('#constructor', () => {
|
||
|
it('throws an exception on empty charset', () => {
|
||
6 years ago
|
expect(() => new HintKeyProducer('')).to.throw(TypeError);
|
||
7 years ago
|
});
|
||
|
});
|
||
|
|
||
|
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]);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|