@@ -4,6 +4,23 @@ import type { ServerNotification } from "../../app-server";
44import { createCodexMockTestFixture , createTestSessionState , setupPromptAndSendNotifications , type CodexMockTestFixture } from "../acp-test-utils" ;
55import { AgentMode } from "../../AgentMode" ;
66
7+ function normalizePathSeparators < T > ( value : T ) : T {
8+ if ( typeof value === "string" ) {
9+ return value . replace ( / \\ / g, "/" ) as unknown as T ;
10+ }
11+ if ( Array . isArray ( value ) ) {
12+ return value . map ( normalizePathSeparators ) as unknown as T ;
13+ }
14+ if ( value && typeof value === "object" ) {
15+ const out : Record < string , unknown > = { } ;
16+ for ( const [ k , v ] of Object . entries ( value as Record < string , unknown > ) ) {
17+ out [ k ] = normalizePathSeparators ( v ) ;
18+ }
19+ return out as unknown as T ;
20+ }
21+ return value ;
22+ }
23+
724describe ( "CodexEventHandler - fuzzy file search events" , ( ) => {
825 let mockFixture : CodexMockTestFixture ;
926 const sessionId = "test-session-id" ;
@@ -55,8 +72,10 @@ describe("CodexEventHandler - fuzzy file search events", () => {
5572
5673 await setupPromptAndSendNotifications ( mockFixture , sessionId , sessionState , [ updated1 , updated2 , completed ] ) ;
5774
58- expect ( events ) . toHaveLength ( 3 ) ;
59- expect ( events [ 0 ] ) . toEqual ( {
75+ const normalizedEvents = normalizePathSeparators ( events ) ;
76+
77+ expect ( normalizedEvents ) . toHaveLength ( 3 ) ;
78+ expect ( normalizedEvents [ 0 ] ) . toEqual ( {
6079 method : "sessionUpdate" ,
6180 args : [
6281 {
@@ -78,7 +97,7 @@ describe("CodexEventHandler - fuzzy file search events", () => {
7897 } ,
7998 ] ,
8099 } ) ;
81- expect ( events [ 1 ] ) . toEqual ( {
100+ expect ( normalizedEvents [ 1 ] ) . toEqual ( {
82101 method : "sessionUpdate" ,
83102 args : [
84103 {
@@ -93,7 +112,7 @@ describe("CodexEventHandler - fuzzy file search events", () => {
93112 } ,
94113 ] ,
95114 } ) ;
96- expect ( events [ 2 ] ) . toEqual ( {
115+ expect ( normalizedEvents [ 2 ] ) . toEqual ( {
97116 method : "sessionUpdate" ,
98117 args : [
99118 {
0 commit comments