Add public building project setting

This commit is contained in:
2026-07-31 17:41:30 +02:00
parent 43a3bb0b69
commit 44b6fde940
29 changed files with 2057 additions and 54 deletions
+13 -1
View File
@@ -18,6 +18,7 @@ function minimalSnapshot() {
externalProjectNumber: null,
buildingOwner: null,
description: null,
isPublicBuilding: true,
singlePhaseVoltageV: 230,
threePhaseVoltageV: 400,
enabledDistributionBoardSupplyTypes: [
@@ -142,7 +143,18 @@ describe("project state snapshot model", () => {
);
});
it("rejects pre-baseline snapshot shapes", () => {
it("upgrades the supported baseline snapshot with a safe building default", () => {
const baseline = structuredClone(minimalSnapshot());
baseline.schemaVersion = 1 as typeof baseline.schemaVersion;
delete (baseline.project as Record<string, unknown>).isPublicBuilding;
const upgraded = parseProjectStateSnapshot(baseline);
assert.equal(upgraded.schemaVersion, projectStateSnapshotSchemaVersion);
assert.equal(upgraded.project.isPublicBuilding, false);
});
it("rejects malformed baseline and unknown snapshot shapes", () => {
const outdated = structuredClone(minimalSnapshot());
delete (outdated.project as Record<string, unknown>).description;
assert.throws(() => parseProjectStateSnapshot(outdated));