From 121d60ce6ba60daedbbffd30550d9f401a302f95 Mon Sep 17 00:00:00 2001 From: David Sarno Date: Thu, 29 Jan 2026 15:53:33 -0800 Subject: [PATCH] Fix CodexConfigHelperTests to account for --prerelease argument in uvx command The uvx command now includes --prerelease and explicit arguments before --from due to beta server mode support. Updated test assertions to check for the correct argument order: Before: [--from, mcpforunityserver>=0.0.0a0, mcp-for-unity, ...] After: [--prerelease, explicit, --from, mcpforunityserver>=0.0.0a0, mcp-for-unity, ...] Updated tests: - BuildCodexServerBlock_OnWindows_IncludesSystemRootEnv - BuildCodexServerBlock_OnNonWindows_ExcludesEnv - UpsertCodexServerBlock_OnWindows_IncludesSystemRootEnv - UpsertCodexServerBlock_OnNonWindows_ExcludesEnv Co-Authored-By: Claude Haiku 4.5 --- .../Helpers/CodexConfigHelperTests.cs | 64 ++++++++++++------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/CodexConfigHelperTests.cs b/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/CodexConfigHelperTests.cs index 95d1a0407..d5de50a30 100644 --- a/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/CodexConfigHelperTests.cs +++ b/TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/CodexConfigHelperTests.cs @@ -241,15 +241,19 @@ public void BuildCodexServerBlock_OnWindows_IncludesSystemRootEnv() // Verify args contains the proper uvx command structure var args = argsNode as TomlArray; - Assert.IsTrue(args.ChildrenCount >= 3, "Args should contain --from, git URL, and package name"); - + Assert.IsTrue(args.ChildrenCount >= 5, "Args should contain --prerelease, explicit, --from, PyPI package reference, and package name"); + var firstArg = (args[0] as TomlString).Value; var secondArg = (args[1] as TomlString).Value; var thirdArg = (args[2] as TomlString).Value; - - Assert.AreEqual("--from", firstArg, "First arg should be --from"); - Assert.IsTrue(secondArg.Contains("mcpforunityserver"), "Second arg should be PyPI package reference"); - Assert.AreEqual("mcp-for-unity", thirdArg, "Third arg should be mcp-for-unity"); + var fourthArg = (args[3] as TomlString).Value; + var fifthArg = (args[4] as TomlString).Value; + + Assert.AreEqual("--prerelease", firstArg, "First arg should be --prerelease"); + Assert.AreEqual("explicit", secondArg, "Second arg should be explicit"); + Assert.AreEqual("--from", thirdArg, "Third arg should be --from"); + Assert.IsTrue(fourthArg.Contains("mcpforunityserver"), "Fourth arg should be PyPI package reference"); + Assert.AreEqual("mcp-for-unity", fifthArg, "Fifth arg should be mcp-for-unity"); // Verify env.SystemRoot is present on Windows bool hasEnv = unityMcp.TryGetNode("env", out var envNode); @@ -306,15 +310,19 @@ public void BuildCodexServerBlock_OnNonWindows_ExcludesEnv() // Verify args contains the proper uvx command structure var args = argsNode as TomlArray; - Assert.IsTrue(args.ChildrenCount >= 3, "Args should contain --from, git URL, and package name"); - + Assert.IsTrue(args.ChildrenCount >= 5, "Args should contain --prerelease, explicit, --from, PyPI package reference, and package name"); + var firstArg = (args[0] as TomlString).Value; var secondArg = (args[1] as TomlString).Value; var thirdArg = (args[2] as TomlString).Value; - - Assert.AreEqual("--from", firstArg, "First arg should be --from"); - Assert.IsTrue(secondArg.Contains("mcpforunityserver"), "Second arg should be PyPI package reference"); - Assert.AreEqual("mcp-for-unity", thirdArg, "Third arg should be mcp-for-unity"); + var fourthArg = (args[3] as TomlString).Value; + var fifthArg = (args[4] as TomlString).Value; + + Assert.AreEqual("--prerelease", firstArg, "First arg should be --prerelease"); + Assert.AreEqual("explicit", secondArg, "Second arg should be explicit"); + Assert.AreEqual("--from", thirdArg, "Third arg should be --from"); + Assert.IsTrue(fourthArg.Contains("mcpforunityserver"), "Fourth arg should be PyPI package reference"); + Assert.AreEqual("mcp-for-unity", fifthArg, "Fifth arg should be mcp-for-unity"); // Verify env is NOT present on non-Windows platforms bool hasEnv = unityMcp.TryGetNode("env", out _); @@ -373,15 +381,19 @@ public void UpsertCodexServerBlock_OnWindows_IncludesSystemRootEnv() // Verify args contains the proper uvx command structure var args = argsNode as TomlArray; - Assert.IsTrue(args.ChildrenCount >= 3, "Args should contain --from, git URL, and package name"); - + Assert.IsTrue(args.ChildrenCount >= 5, "Args should contain --prerelease, explicit, --from, PyPI package reference, and package name"); + var firstArg = (args[0] as TomlString).Value; var secondArg = (args[1] as TomlString).Value; var thirdArg = (args[2] as TomlString).Value; - - Assert.AreEqual("--from", firstArg, "First arg should be --from"); - Assert.IsTrue(secondArg.Contains("mcpforunityserver"), "Second arg should be PyPI package reference"); - Assert.AreEqual("mcp-for-unity", thirdArg, "Third arg should be mcp-for-unity"); + var fourthArg = (args[3] as TomlString).Value; + var fifthArg = (args[4] as TomlString).Value; + + Assert.AreEqual("--prerelease", firstArg, "First arg should be --prerelease"); + Assert.AreEqual("explicit", secondArg, "Second arg should be explicit"); + Assert.AreEqual("--from", thirdArg, "Third arg should be --from"); + Assert.IsTrue(fourthArg.Contains("mcpforunityserver"), "Fourth arg should be PyPI package reference"); + Assert.AreEqual("mcp-for-unity", fifthArg, "Fifth arg should be mcp-for-unity"); // Verify env.SystemRoot is present on Windows bool hasEnv = unityMcp.TryGetNode("env", out var envNode); @@ -447,15 +459,19 @@ public void UpsertCodexServerBlock_OnNonWindows_ExcludesEnv() // Verify args contains the proper uvx command structure var args = argsNode as TomlArray; - Assert.IsTrue(args.ChildrenCount >= 3, "Args should contain --from, git URL, and package name"); - + Assert.IsTrue(args.ChildrenCount >= 5, "Args should contain --prerelease, explicit, --from, PyPI package reference, and package name"); + var firstArg = (args[0] as TomlString).Value; var secondArg = (args[1] as TomlString).Value; var thirdArg = (args[2] as TomlString).Value; - - Assert.AreEqual("--from", firstArg, "First arg should be --from"); - Assert.IsTrue(secondArg.Contains("mcpforunityserver"), "Second arg should be PyPI package reference"); - Assert.AreEqual("mcp-for-unity", thirdArg, "Third arg should be mcp-for-unity"); + var fourthArg = (args[3] as TomlString).Value; + var fifthArg = (args[4] as TomlString).Value; + + Assert.AreEqual("--prerelease", firstArg, "First arg should be --prerelease"); + Assert.AreEqual("explicit", secondArg, "Second arg should be explicit"); + Assert.AreEqual("--from", thirdArg, "Third arg should be --from"); + Assert.IsTrue(fourthArg.Contains("mcpforunityserver"), "Fourth arg should be PyPI package reference"); + Assert.AreEqual("mcp-for-unity", fifthArg, "Fifth arg should be mcp-for-unity"); // Verify env is NOT present on non-Windows platforms bool hasEnv = unityMcp.TryGetNode("env", out _);