feat: initialize TJWater WebGIS frontend
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { parseRuntimeConfig } from "./env";
|
||||
|
||||
describe("runtime frontend configuration", () => {
|
||||
it("uses container-provided values without relying on Vite build variables", () => {
|
||||
expect(
|
||||
parseRuntimeConfig({
|
||||
TJWATER_MAPBOX_ACCESS_TOKEN: "token",
|
||||
TJWATER_MAP_URL: "https://maps.example.test/geoserver",
|
||||
TJWATER_GEOSERVER_WORKSPACE: "project-a",
|
||||
TJWATER_AGENT_API_BASE_URL: "https://agent.example.test",
|
||||
TJWATER_ENABLE_DEV_PANEL: "true",
|
||||
TJWATER_ENABLE_MSW: "false"
|
||||
})
|
||||
).toEqual({
|
||||
TJWATER_MAPBOX_ACCESS_TOKEN: "token",
|
||||
TJWATER_MAP_URL: "https://maps.example.test/geoserver",
|
||||
TJWATER_GEOSERVER_WORKSPACE: "project-a",
|
||||
TJWATER_AGENT_API_BASE_URL: "https://agent.example.test",
|
||||
TJWATER_ENABLE_DEV_PANEL: true,
|
||||
TJWATER_ENABLE_MSW: false
|
||||
});
|
||||
});
|
||||
|
||||
it("applies typed defaults for optional feature flags", () => {
|
||||
expect(parseRuntimeConfig({})).toMatchObject({
|
||||
TJWATER_ENABLE_DEV_PANEL: false,
|
||||
TJWATER_ENABLE_MSW: false
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects invalid runtime URLs before the application starts", () => {
|
||||
expect(() => parseRuntimeConfig({ TJWATER_MAP_URL: "not-a-url" })).toThrow();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user