import type { RasterLayerSpecification } from "maplibre-gl"; import { describe, expect, it } from "vitest"; import { createBaseStyle, createWaterNetworkSources, SOURCE_LAYERS } from "./sources"; describe("createWaterNetworkSources", () => { it("loads SCADA tiles from the lingang:scada_points GeoServer layer", () => { const scada = createWaterNetworkSources().scada; expect(SOURCE_LAYERS.scada).toBe("scada_points"); expect(scada.tiles).toEqual([ expect.stringContaining("/lingang:scada_points/point/WebMercatorQuad/") ]); expect(scada.promoteId).toBe("scada_id"); }); }); describe("createBaseStyle", () => { it("calibrates light and satellite rasters for solid workbench surfaces", () => { const style = createBaseStyle("test-token"); const light = style.layers.find((layer) => layer.id === "mapbox-light") as RasterLayerSpecification; const satellite = style.layers.find((layer) => layer.id === "mapbox-satellite") as RasterLayerSpecification; expect(light.paint).toMatchObject({ "raster-opacity": 0.96, "raster-saturation": -0.1, "raster-contrast": 0.06 }); expect(satellite.paint).toMatchObject({ "raster-opacity": 1, "raster-saturation": -0.24, "raster-contrast": -0.06 }); }); });