Mapper falls back to legacy trickle vent label for pre-existing API responses 🟥

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-06-30 13:34:06 +00:00
parent 7fcb64bd8c
commit 093563b0c9

View file

@ -8,6 +8,7 @@ import domain.magicplan.api.response as api
from domain.magicplan.api.response import MagicPlanPlan, Symbol, Vec3, WallItem
from domain.magicplan.mapper import (
_map_window, # pyright: ignore[reportPrivateUsage]
_map_window_ventilation, # pyright: ignore[reportPrivateUsage]
map_address,
map_plan,
)
@ -229,3 +230,28 @@ def test_map_address_city_absent_is_omitted() -> None:
def test_map_address_none_returns_none() -> None:
assert map_address(None) is None
def _make_survey_field(label: str, value: str) -> api.SurveyField:
return api.SurveyField(
id="test",
type=5,
type_as_string="float",
is_required=False,
label=label,
value=api.FieldValue(index=-1, has_value=True, is_array=False, value=value),
)
def test_trickle_vent_area_read_from_legacy_field_label() -> None:
# Arrange — old MagicPlan label, not yet renamed in the API response
fields = [_make_survey_field(
"Trickle Vent Effective Area (mm2) (No Code Then Width x Height)", "1700"
)]
# Act
vent = _map_window_ventilation(fields)
# Assert
assert vent is not None
assert vent.trickle_vent_area_mm2 == 1700