Total Complexity | 2 |
Complexity/F | 0 |
Lines of Code | 30 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import Symbolizer from './Symbolizer' |
||
2 | |||
3 | test('New Symbolizer is the expected type', () => { |
||
4 | const a = new Symbolizer() |
||
5 | expect(typeof a).toBe('object') |
||
6 | expect(a.constructor.name).toBe('Symbolizer') |
||
7 | }) |
||
8 | |||
9 | test('Default symbolizer generates "αβγδεζηθικλμνξοπρςστυφχψω"', () => { |
||
10 | const a = new Symbolizer() |
||
11 | const g = a.generator() |
||
12 | const x = 'αβγδεζηθικλμνξοπρςστυφχψω' |
||
13 | let s = '' |
||
14 | for (let i=0; i<x.length; i++) { |
||
15 | s += g.next().value |
||
16 | } |
||
17 | expect(s).toBe(x) |
||
18 | }) |
||
19 | |||
20 | test('Custom symbolizer generates as specified, followed by default symbols', () => { |
||
21 | const a = new Symbolizer('xyzw') |
||
22 | const g = a.generator() |
||
23 | const x = 'xyzwαβγδ' |
||
24 | let s = '' |
||
25 | for (let i=0; i<x.length; i++) { |
||
26 | s += g.next().value |
||
27 | } |
||
28 | expect(s).toBe(x) |
||
29 | }) |
||
30 |