fix: stabilize cross-platform CI checks

Use the repository's default Electron import pattern in the MCP OAuth service, make the attachment-path test platform-neutral, and ensure the hook runner cwd/env test drains stdin before asserting shell output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-28 15:27:48 +01:00
co-authored by Copilot
parent 6321f9192d
commit 036fb4d4fa
3 changed files with 8 additions and 5 deletions
@@ -10,13 +10,14 @@ public sealed class AryxCopilotAgentMessageOptionsTests
[Fact] [Fact]
public async Task ProcessMessageAttachmentsAsync_MapsProtocolAttachmentsAndMessageMode() public async Task ProcessMessageAttachmentsAsync_MapsProtocolAttachmentsAndMessageMode()
{ {
string attachmentPath = Path.GetFullPath(Path.Combine(Path.GetTempPath(), "aryx-tests", "assets", "diagram.png"));
ChatMessage message = new(ChatRole.User, "Please inspect these images."); ChatMessage message = new(ChatRole.User, "Please inspect these images.");
message.Contents.Add(new AIContent message.Contents.Add(new AIContent
{ {
RawRepresentation = new ChatMessageAttachmentDto RawRepresentation = new ChatMessageAttachmentDto
{ {
Type = "file", Type = "file",
Path = @"C:\workspace\project\assets\diagram.png", Path = attachmentPath,
DisplayName = "diagram.png", DisplayName = "diagram.png",
}, },
}); });
@@ -47,7 +48,7 @@ public sealed class AryxCopilotAgentMessageOptionsTests
first => first =>
{ {
UserMessageDataAttachmentsItemFile file = Assert.IsType<UserMessageDataAttachmentsItemFile>(first); UserMessageDataAttachmentsItemFile file = Assert.IsType<UserMessageDataAttachmentsItemFile>(first);
Assert.Equal(@"C:\workspace\project\assets\diagram.png", file.Path); Assert.Equal(attachmentPath, file.Path);
Assert.Equal("diagram.png", file.DisplayName); Assert.Equal("diagram.png", file.DisplayName);
}, },
second => second =>
@@ -71,8 +71,8 @@ public sealed class HookCommandRunnerTests
string hooksDirectory = Directory.CreateDirectory(Path.Combine(project.Path, "scripts")).FullName; string hooksDirectory = Directory.CreateDirectory(Path.Combine(project.Path, "scripts")).FullName;
HookCommandDefinition hook = CreatePlatformHook( HookCommandDefinition hook = CreatePlatformHook(
OperatingSystem.IsWindows() OperatingSystem.IsWindows()
? "Write-Output ((Get-Location).Path + '|' + $env:HOOK_TEST_ENV)" ? "$null = [Console]::In.ReadToEnd(); Write-Output ([Environment]::CurrentDirectory + '|' + $env:HOOK_TEST_ENV)"
: "printf '%s|%s' \"$(pwd)\" \"$HOOK_TEST_ENV\"", : "cat >/dev/null; printf '%s|%s' \"$(pwd)\" \"$HOOK_TEST_ENV\"",
cwd: "scripts", cwd: "scripts",
env: new Dictionary<string, string> env: new Dictionary<string, string>
{ {
+3 -1
View File
@@ -1,12 +1,14 @@
import { randomBytes, createHash } from 'node:crypto'; import { randomBytes, createHash } from 'node:crypto';
import { createServer, type Server, type IncomingMessage, type ServerResponse } from 'node:http'; import { createServer, type Server, type IncomingMessage, type ServerResponse } from 'node:http';
import { shell } from 'electron'; import electron from 'electron';
import type { McpOauthStaticClientConfig } from '@shared/domain/mcpAuth'; import type { McpOauthStaticClientConfig } from '@shared/domain/mcpAuth';
import { storeToken, buildWellKnownUrl, buildWellKnownUrlFallback, type McpOAuthToken } from './mcpTokenStore'; import { storeToken, buildWellKnownUrl, buildWellKnownUrlFallback, type McpOAuthToken } from './mcpTokenStore';
const { shell } = electron;
/* ── Public API ──────────────────────────────────────────────── */ /* ── Public API ──────────────────────────────────────────────── */
export interface McpOAuthFlowOptions { export interface McpOAuthFlowOptions {