diff --git a/backend/tests/test_openapi_blocked_task_error_schema.py b/backend/tests/test_openapi_blocked_task_error_schema.py index c1720a81..0ae6075f 100644 --- a/backend/tests/test_openapi_blocked_task_error_schema.py +++ b/backend/tests/test_openapi_blocked_task_error_schema.py @@ -13,4 +13,15 @@ def test_openapi_blocked_task_error_includes_code_field() -> None: # `code` is optional but must be documented for clients. assert "code" in props - assert props["code"].get("anyOf") + required_fields = blocked_detail.get("required", []) + assert "code" not in required_fields + + code_schema = props["code"] + any_of = code_schema.get("anyOf") + assert isinstance(any_of, list) and any_of + + has_string_branch = any(branch.get("type") == "string" for branch in any_of) + assert has_string_branch + + has_null_branch = any(branch.get("type") == "null" or branch.get("nullable") is True for branch in any_of) + assert has_null_branch diff --git a/backend/tests/test_tasks_blocked_lead_comment_only.py b/backend/tests/test_tasks_blocked_lead_dependency_only.py similarity index 100% rename from backend/tests/test_tasks_blocked_lead_comment_only.py rename to backend/tests/test_tasks_blocked_lead_dependency_only.py