aa8a0bd83f
Ingest aircraft and vessel tracks via OSINT feeds and tactical CoT, expose viewport-filtered SSE to the map, and add an OSM ALPR layer with tiled caching and performant marker sync.
58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import { formatAlprPopup } from '../../app/utils/alprMapLayer.js'
|
|
|
|
describe('formatAlprPopup', () => {
|
|
it('summarizes manufacturer, model, and operator', () => {
|
|
const html = formatAlprPopup({
|
|
osmId: 1,
|
|
manufacturer: 'Flock Safety',
|
|
model: 'Falcon',
|
|
operator: 'City PD',
|
|
direction: 90,
|
|
fov: 60,
|
|
})
|
|
expect(html).toContain('Flock Safety')
|
|
expect(html).toContain('Falcon')
|
|
expect(html).toContain('License plate reader')
|
|
expect(html).toContain('City PD')
|
|
expect(html).toContain('Facing E (90°)')
|
|
expect(html).toContain('~60° view')
|
|
expect(html).not.toContain('Manufacturer')
|
|
expect(html).not.toContain('fixme')
|
|
})
|
|
|
|
it('uses name as title with make/model below', () => {
|
|
const html = formatAlprPopup({
|
|
osmId: 2,
|
|
name: 'Peachtree & 5th',
|
|
manufacturer: 'Flock Safety',
|
|
model: 'Falcon',
|
|
})
|
|
expect(html).toContain('<strong>Peachtree & 5th</strong>')
|
|
expect(html).toContain('Model</span> <strong>Falcon</strong>')
|
|
expect(html).toContain('Flock Safety Falcon')
|
|
})
|
|
|
|
it('links operator wikidata inline', () => {
|
|
const html = formatAlprPopup({
|
|
osmId: 3,
|
|
operator: 'Atlanta Police',
|
|
operatorWikidata: 'Q123',
|
|
})
|
|
expect(html).toContain('<strong>')
|
|
expect(html).toContain('href="https://www.wikidata.org/wiki/Q123"')
|
|
expect(html).toContain('Atlanta Police')
|
|
expect(html).not.toContain('Wikidata')
|
|
})
|
|
|
|
it('shows model unknown when OSM lacks model tag', () => {
|
|
const html = formatAlprPopup({
|
|
osmId: 4,
|
|
manufacturer: 'Flock Safety',
|
|
modelUnknown: true,
|
|
})
|
|
expect(html).toContain('Flock Safety')
|
|
expect(html).toContain('Model not recorded in OpenStreetMap')
|
|
})
|
|
})
|