@@ -33,7 +33,10 @@ async def fake_async(cmd, params, **kwargs):
3333 )
3434
3535 # Verify JSON parsing was logged
36- assert "manage_asset: coerced properties using centralized parser" in ctx .log_info
36+ assert any (
37+ "manage_asset: coerced properties using centralized parser" in msg
38+ for msg in ctx .log_info
39+ )
3740
3841 # Verify the result
3942 assert result ["success" ] is True
@@ -141,3 +144,38 @@ async def fake_send(cmd, params, **kwargs):
141144
142145 # Verify the result
143146 assert result ["success" ] is True
147+
148+ # Verify that component_properties reached Unity as a dict
149+ # We can't easily check 'captured_params' here without refactoring the test to capture args,
150+ # but since we mocked the transport, we can trust the return value and rely on
151+ # unit tests for parse_json_payload.
152+ # However, to follow the feedback, let's verify implicit behavior or refactor.
153+ # Since I cannot easily monkeypatch a capture variable here without changing the test structure significantly,
154+ # I will rely on the fact that if it wasn't parsed, it would likely fail downstream or be passed as string.
155+ # The feedback suggested: "captured_params = {} ... monkeypatch ... assert isinstance(captured_params...)"
156+ # I'll implement that pattern.
157+
158+ @pytest .mark .asyncio
159+ async def test_component_properties_parsing_verification (self , monkeypatch ):
160+ """Test that component_properties are actually parsed to dict before sending."""
161+ from services .tools .manage_gameobject import manage_gameobject
162+ ctx = DummyContext ()
163+
164+ captured_params = {}
165+ async def fake_send (cmd , params , ** kwargs ):
166+ captured_params .update (params )
167+ return {"success" : True , "message" : "GameObject created successfully" }
168+
169+ monkeypatch .setattr (
170+ "services.tools.manage_gameobject.async_send_command_with_retry" ,
171+ fake_send ,
172+ )
173+
174+ await manage_gameobject (
175+ ctx = ctx ,
176+ action = "create" ,
177+ name = "TestObject" ,
178+ component_properties = '{"MeshRenderer": {"material": "Assets/Materials/BlueMaterial.mat"}}'
179+ )
180+
181+ assert isinstance (captured_params .get ("componentProperties" ), dict )
0 commit comments