Fix CodexConfigHelperTests to account for --prerelease argument in uvx command (#652)

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 <noreply@anthropic.com>
main
dsarno 2026-01-29 15:54:44 -08:00 committed by GitHub
parent 402eab56f9
commit b555550d62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 40 additions and 24 deletions

View File

@ -241,15 +241,19 @@ namespace MCPForUnityTests.Editor.Helpers
// 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;
var fourthArg = (args[3] as TomlString).Value;
var fifthArg = (args[4] 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");
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 @@ namespace MCPForUnityTests.Editor.Helpers
// 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;
var fourthArg = (args[3] as TomlString).Value;
var fifthArg = (args[4] 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");
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 @@ namespace MCPForUnityTests.Editor.Helpers
// 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;
var fourthArg = (args[3] as TomlString).Value;
var fifthArg = (args[4] 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");
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 @@ namespace MCPForUnityTests.Editor.Helpers
// 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;
var fourthArg = (args[3] as TomlString).Value;
var fifthArg = (args[4] 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");
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 _);