forked from OurHike/OurHike
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlegendLabels.test.ts
More file actions
27 lines (23 loc) · 1.01 KB
/
Copy pathlegendLabels.test.ts
File metadata and controls
27 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { describe, it, expect } from 'vitest'
import { typeLabel } from './legendLabels'
import { POI_TYPES } from '../lib/config'
// One place that turns a pipeline `type` string into words a hiker reads -
// shared by the legend and the search results so the same thing is never
// called two different names on two screens.
describe('typeLabel', () => {
it('gives every published POI type a human label', () => {
for (const type of POI_TYPES) {
expect(typeLabel(type)).not.toBe(type)
}
})
it('labels the two map-only types the legend also has to name', () => {
expect(typeLabel('closure')).toBe('Closure')
expect(typeLabel('serious-warning')).toBe('Serious warning')
})
it('shows an unknown type as itself rather than as nothing', () => {
// The pipeline can publish a type this build predates. Showing the raw
// string is honest and still findable; showing a blank row, or "undefined",
// hides a real thing that is on the trail.
expect(typeLabel('yurt')).toBe('yurt')
})
})