diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-22 22:00:42 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-08-22 22:00:42 +0900 |
commit | ab5fd9a336166cab75ff00e65afb4be991ff0765 (patch) | |
tree | f2e933c927baf64cc393ea1a83ed57cc1fcc9bb2 /test/content/hint-key-producer.test.js | |
parent | 13fb726332e9638cb3fafc477cf9fe641cb906ce (diff) | |
parent | dcebe336281d068649927a8bb8d3c0403807ef01 (diff) |
Merge branch 'follow-hints'
Diffstat (limited to 'test/content/hint-key-producer.test.js')
-rw-r--r-- | test/content/hint-key-producer.test.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/content/hint-key-producer.test.js b/test/content/hint-key-producer.test.js new file mode 100644 index 0000000..74fb462 --- /dev/null +++ b/test/content/hint-key-producer.test.js @@ -0,0 +1,25 @@ +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]); + } + }); + }); +}); |