import pathlib ROOT = pathlib.Path(__file__).resolve().parent.parent UI_JS = ROOT / "static" / "ui.js" def _read_ui() -> str: return UI_JS.read_text(encoding="utf-8") def test_select_model_custom_option_uses_friendly_label_helper(): src = _read_ui() start = src.find("function _ensureModelOptionInDropdown") assert start != -1, "_ensureModelOptionInDropdown() not found" end = src.find("\nfunction _modelStateFromAppliedDropdown", start) assert end != -1, "_modelStateFromAppliedDropdown() boundary not found" body = src[start:end] assert "getModelLabel(modelId)" in body, ( "Temporary model options should use getModelLabel(modelId) so the chip shows a " "friendly label instead of a raw slug when the value is not already in the " "native