feat(workbench): integrate runtime data and map tooling

This commit is contained in:
2026-09-22 10:45:46 +08:00
parent bf44cc0f25
commit bebcf2a06c
163 changed files with 15642 additions and 1312 deletions
@@ -0,0 +1,35 @@
import type { MapGeoJSONFeature } from "maplibre-gl";
import { describe, expect, it } from "vitest";
import { getWaterNetworkSourceId, toDetailFeature } from "./feature-adapter";
describe("feature adapter", () => {
it("classifies API-backed SCADA features by their canonical source id", () => {
const feature = {
id: "SCADA-1",
source: "scada",
properties: {
device_id: "SCADA-1",
device_type: "pressure",
node_id: "J-1"
}
} as unknown as MapGeoJSONFeature;
expect(getWaterNetworkSourceId(feature)).toBe("scada");
expect(toDetailFeature(feature)).toMatchObject({
id: "SCADA-1",
layer: "scada",
title: "SCADA SCADA-1"
});
});
it("continues to classify vector features by source layer", () => {
const feature = {
id: "J-1",
source: "water-network",
sourceLayer: "junctions",
properties: { id: "J-1" }
} as unknown as MapGeoJSONFeature;
expect(getWaterNetworkSourceId(feature)).toBe("junctions");
});
});