mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-08 20:58:45 +02:00
fix: use system copilot in development
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using Kopaya.AgentHost.Services;
|
||||
|
||||
namespace Kopaya.AgentHost.Tests;
|
||||
|
||||
public sealed class CopilotCliPathResolverTests
|
||||
{
|
||||
[Fact]
|
||||
public void Resolve_UsesCopilotFromPathDuringDevelopment()
|
||||
{
|
||||
string copilotDirectory = @"C:\tools\copilot";
|
||||
HashSet<string> existingFiles = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
Path.Combine(copilotDirectory, "copilot.exe"),
|
||||
};
|
||||
|
||||
CopilotCliResolution resolution = CopilotCliPathResolver.Resolve(
|
||||
processPath: @"C:\Program Files\dotnet\dotnet.exe",
|
||||
pathValue: $"C:\\other;\"{copilotDirectory}\"",
|
||||
pathExtValue: ".COM;.EXE;.BAT;.CMD",
|
||||
isWindows: true,
|
||||
fileExists: existingFiles.Contains);
|
||||
|
||||
Assert.True(resolution.ShouldOverrideCliPath);
|
||||
Assert.Equal(Path.Combine(copilotDirectory, "copilot.exe"), resolution.CliPath, ignoreCase: true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Resolve_LeavesPackagedRuntimeOnBundledCli()
|
||||
{
|
||||
CopilotCliResolution resolution = CopilotCliPathResolver.Resolve(
|
||||
processPath: @"C:\Program Files\Kopaya\Kopaya.AgentHost.exe",
|
||||
pathValue: @"C:\tools",
|
||||
pathExtValue: ".COM;.EXE;.BAT;.CMD",
|
||||
isWindows: true,
|
||||
fileExists: _ => true);
|
||||
|
||||
Assert.False(resolution.ShouldOverrideCliPath);
|
||||
Assert.Null(resolution.CliPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Resolve_ReportsMissingCopilotWhenDevelopmentPathDoesNotContainIt()
|
||||
{
|
||||
CopilotCliResolution resolution = CopilotCliPathResolver.Resolve(
|
||||
processPath: @"C:\Program Files\dotnet\dotnet.exe",
|
||||
pathValue: @"C:\tools;C:\other",
|
||||
pathExtValue: ".COM;.EXE;.BAT;.CMD",
|
||||
isWindows: true,
|
||||
fileExists: _ => false);
|
||||
|
||||
Assert.True(resolution.ShouldOverrideCliPath);
|
||||
Assert.Null(resolution.CliPath);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user