bb01e9a06c
## Summary - **ADS-B & AIS:** OpenSky and AISStream OSINT feeds upsert into the CoT store; tactical tracks still arrive via adsbcot/aiscot on `:8089`. Map clients subscribe via `GET /api/cot/stream` (SSE) with viewport bbox filtering and Air / Surface / Team layer toggles. - **ALPR (Flock/OSM):** Toggleable license-plate reader layer sourced from OpenStreetMap, with SQLite cache, Overpass fallback, tiled viewport fetching, and clustered markers with direction cones. - **Map performance:** Ring-based tile selection (fixes zoom-out crash), immutable tile cache, incremental marker sync, split cluster load/query, and padded SSE bbox to reduce reconnect churn. ## Docs - `docs/tracking.md` — ADS-B/AIS accuracy tiers, freshness, self-hosted receivers, optional OSINT API keys - `docs/map-and-cameras.md` — ALPR layer and map behavior updates --------- Co-authored-by: Madison Grubb <madison@elastiflow.com> Reviewed-on: #36
69 lines
2.0 KiB
JavaScript
69 lines
2.0 KiB
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import {
|
|
cotAirIconKind,
|
|
cotCategory,
|
|
formatCotPopup,
|
|
getCotIconHtml,
|
|
} from '../../app/utils/cotDisplay.js'
|
|
|
|
const esc = s => String(s)
|
|
|
|
describe('cotDisplay', () => {
|
|
it('detects helicopter from CoT type', () => {
|
|
expect(cotAirIconKind({ type: 'a-f-A-C-H' })).toBe('helicopter')
|
|
expect(cotAirIconKind({ type: 'a-f-A-C-F' })).toBe('fixedWing')
|
|
})
|
|
|
|
it('renders distinct air icon kinds', () => {
|
|
const plane = getCotIconHtml({ type: 'a-f-A-C-F', heading: 90 })
|
|
const heli = getCotIconHtml({ type: 'a-f-A-C-H', heading: 180 })
|
|
expect(plane.className).toBe('cot-entity-fixedWing')
|
|
expect(heli.className).toBe('cot-entity-helicopter')
|
|
expect(plane.html).toContain('rotate(90deg)')
|
|
expect(heli.html).toContain('rotate(180deg)')
|
|
})
|
|
|
|
it('formats rich ADS-B popup', () => {
|
|
const html = formatCotPopup({
|
|
source: 'adsb',
|
|
type: 'a-f-A-C-F',
|
|
label: 'UAL123',
|
|
icao: 'abc123',
|
|
originCountry: 'United States',
|
|
altitude: 10000,
|
|
speed: 200,
|
|
heading: 270,
|
|
verticalRate: 5,
|
|
squawk: '1200',
|
|
}, esc)
|
|
expect(html).toContain('UAL123')
|
|
expect(html).toContain('Aircraft')
|
|
expect(html).toContain('ICAO ABC123')
|
|
expect(html).toContain('United States')
|
|
expect(html).toContain('ft')
|
|
expect(html).toContain('kt')
|
|
expect(html).toContain('270°')
|
|
expect(html).toContain('Squawk 1200')
|
|
})
|
|
|
|
it('formats vessel popup with MMSI', () => {
|
|
const html = formatCotPopup({
|
|
source: 'ais',
|
|
type: 'a-f-S-C',
|
|
label: 'TEST SHIP',
|
|
id: 'MMSI.366123456',
|
|
speed: 12,
|
|
heading: 90,
|
|
}, esc)
|
|
expect(html).toContain('Vessel')
|
|
expect(html).toContain('MMSI 366123456')
|
|
})
|
|
|
|
it('formats team popup', () => {
|
|
expect(cotCategory('a-f-G-U-C')).toBe('ground')
|
|
const html = formatCotPopup({ type: 'a-f-G-U-C', label: 'Alpha 1' }, esc)
|
|
expect(html).toContain('Team')
|
|
expect(html).toContain('Alpha 1')
|
|
})
|
|
})
|