diff --git a/tests/components/silvercrest_infrared/test_config_flow.py b/tests/components/silvercrest_infrared/test_config_flow.py index 6ab3d04fc08c..3eeee66b7a87 100644 --- a/tests/components/silvercrest_infrared/test_config_flow.py +++ b/tests/components/silvercrest_infrared/test_config_flow.py @@ -103,3 +103,30 @@ async def test_user_flow_no_emitters_receivers(hass: HomeAssistant) -> None: assert result["type"] is FlowResultType.ABORT assert result["reason"] == "no_infrared_entities" + + +@pytest.mark.usefixtures("mock_infrared_emitter_entity", "mock_setup_entry") +async def test_user_flow_requires_emitter( + hass: HomeAssistant, +) -> None: + """Test user flow requires an infrared emitter or receiver.""" + result = await hass.config_entries.flow.async_init( + DOMAIN, context={"source": SOURCE_USER} + ) + + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + user_input={CONF_DEVICE_TYPE: SilverCrestIrDeviceType.STVD45A1}, + ) + + assert result["type"] is FlowResultType.FORM + assert result["errors"] == {"base": "missing_infrared_entity"} + + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + user_input={ + CONF_DEVICE_TYPE: SilverCrestIrDeviceType.STVD45A1, + CONF_INFRARED_ENTITY_ID: EMITTER_ENTITY_ID, + }, + ) + assert result["type"] is FlowResultType.CREATE_ENTRY