mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 18:34:02 +00:00
Seven contributed CCTV camera packs (Ontario 511, Fintraffic Finland, DriveBC, TxDOT Texas, Estonia Tallinn + Tarktee, Warendorf, Live Traffic NSW) on a fair per-pack catalog cap; semantic camera labels; monitor planes lifted clear of the terrain from a precomputed, bundled ground-height dataset. Default catalog 800 → 3,446 cameras. Full context in PR #433. Co-authored-by: sendmebits <[email protected]> Co-authored-by: avocadoAgent <[email protected]> Co-authored-by: Alex Harvey <[email protected]> Co-authored-by: Jason Meredith <[email protected]> Co-authored-by: Daniel Smith <[email protected]> Co-authored-by: Vladimir Sobolev <[email protected]> Co-authored-by: Matthias Schneider <[email protected]> Co-authored-by: Cyber Knight <[email protected]> Co-authored-by: NovaSoft Australia <[email protected]>
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
import { test } from 'node:test';
|
||
import assert from 'node:assert/strict';
|
||
import {
|
||
CAMERA_CODE_MAX_CHARS,
|
||
cameraDisplayCode,
|
||
normalizeSourceItem,
|
||
} from '../../server/providers/cctv/normalize.js';
|
||
|
||
test('cameraDisplayCode trims long names with an ellipsis and collapses whitespace', () => {
|
||
assert.equal(
|
||
cameraDisplayCode(' IH 35 at Cesar Chavez '),
|
||
'IH 35 at Cesar Chavez',
|
||
);
|
||
const long = 'City of Windsor – Goyeau Street and Park Street';
|
||
const code = cameraDisplayCode(long);
|
||
assert.equal(code.length, CAMERA_CODE_MAX_CHARS);
|
||
assert.ok(code.endsWith('…'));
|
||
assert.equal(cameraDisplayCode(''), '');
|
||
});
|
||
|
||
test('every pack labels by its feed name; explicit codes win; the id is the last resort', () => {
|
||
const base = { lat: 1, lon: 1, url: 'https://x.test/a.jpg' };
|
||
assert.equal(
|
||
normalizeSourceItem({
|
||
...base,
|
||
id: '354',
|
||
name: '5TH ST / CONGRESS AVE',
|
||
sourceKind: 'austin-open-data',
|
||
}).code,
|
||
'5TH ST / CONGRESS AVE',
|
||
);
|
||
assert.equal(
|
||
normalizeSourceItem({
|
||
...base,
|
||
id: 'on-860',
|
||
name: 'Goyeau Street and Park Street',
|
||
sourceKind: 'ontario-511-open-data',
|
||
}).code,
|
||
'GOYEAU STREET AND PARK STRE…',
|
||
);
|
||
assert.equal(
|
||
normalizeSourceItem({
|
||
...base,
|
||
id: 'nsw-46fa631a',
|
||
name: 'Erskine Street looking west',
|
||
sourceKind: 'nsw-livetraffic',
|
||
code: 'ERSKINE ST (SYDNEY)',
|
||
}).code,
|
||
'ERSKINE ST (SYDNEY)',
|
||
);
|
||
assert.equal(
|
||
normalizeSourceItem({
|
||
...base,
|
||
id: 'fi-c1455101',
|
||
name: '',
|
||
sourceKind: 'fintraffic-open-data',
|
||
}).code,
|
||
'fi-c1455101',
|
||
'a missing name falls back to the id',
|
||
);
|
||
});
|