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 configured GeoServer workspace", () => { const scada = createWaterNetworkSources().scada; expect(SOURCE_LAYERS.scada).toBe("geo_scadas_mat"); expect(scada.tiles).toEqual([ expect.stringContaining("/wenzhou:geo_scadas_mat/point/WebMercatorQuad/") ]); expect(scada.bounds).toEqual([ 120.63483136963328, 27.957404243937606, 120.76346113516635, 28.02399422971424 ]); expect(scada.promoteId).toBe("sensor_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 }); }); });