diff --git a/tests/domain/modelling/test_roof_recommendation.py b/tests/domain/modelling/test_roof_recommendation.py index 6759341ed..55b459da7 100644 --- a/tests/domain/modelling/test_roof_recommendation.py +++ b/tests/domain/modelling/test_roof_recommendation.py @@ -216,6 +216,32 @@ def test_unlodged_roof_type_with_nd_thickness_yields_no_recommendation() -> None assert recommendation is None +def test_loft_below_building_regs_depth_yields_loft_insulation() -> None: + # Arrange — property 724702's shape (ADR-0063): an unlodged roof type with a + # lodged 50 mm loft, below the 270 mm building-regs compliance gate. A + # measured depth is a positive statement of a real loft (unlike a sentinel on + # an unlodged type, which keeps deferring), so the below-regs top-up fires and + # reaches the 300 mm install depth. + baseline: EpcPropertyData = build_epc() + main: SapBuildingPart = _part(baseline, BuildingPartIdentifier.MAIN) + main.roof_construction_type = None + main.roof_insulation_thickness = "50mm" + + # Act + recommendation: Recommendation | None = recommend_roof_insulation( + baseline, _StubProducts() + ) + + # Assert + assert recommendation is not None + option = recommendation.options[0] + assert option.measure_type == "loft_insulation" + simulated: EpcPropertyData = apply_simulations(baseline, [option.overlay]) + assert ( + _part(simulated, BuildingPartIdentifier.MAIN).roof_insulation_thickness == 300 + ) + + def test_loft_option_carries_cost_from_roof_area_and_product() -> None: # Arrange baseline: EpcPropertyData = build_epc() # MAIN roof area 14.85 m^2