Passed
Push — main ( 590153...ba27c8 )
by Dylan
04:30
created

src/Symbolizer.test.ts   A

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 30
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 24
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 2
mnd 2
bc 2
fnc 0
bpm 0
cpm 0
noi 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