@@ -431,7 +431,8 @@ describe("CodexAppServerEventProjector", () => {
431431 } ,
432432 } ) ,
433433 ) ;
434- const toolProgressText = onToolResult . mock . calls . at ( 0 ) ?. [ 0 ] ?. text ;
434+ const toolProgressText = ( mockCallArg ( onToolResult , 0 , 0 , "onToolResult" ) as { text ?: string } )
435+ . text ;
435436 expect ( toolProgressText ) . toBe ( "🛠️ `run tests (workspace)`" ) ;
436437
437438 await projector . handleNotification (
@@ -1457,7 +1458,7 @@ describe("CodexAppServerEventProjector", () => {
14571458 } ) ,
14581459 ) ;
14591460
1460- const text = onToolResult . mock . calls . at ( 0 ) ?. [ 0 ] ? .text ;
1461+ const text = ( mockCallArg ( onToolResult , 0 , 0 , "onToolResult" ) as { text ?: string } ) . text ;
14611462 expect ( text ) . toContain ( "sk-123…ZZZZ" ) ;
14621463 expect ( text ) . not . toContain ( "sk-1234567890abcdefZZZZ" ) ;
14631464 } ) ;
@@ -1589,7 +1590,10 @@ describe("CodexAppServerEventProjector", () => {
15891590 ) ;
15901591
15911592 expect ( onToolResult ) . toHaveBeenCalledTimes ( 21 ) ;
1592- expect ( onToolResult . mock . calls . at ( 19 ) ?. [ 0 ] ?. text ) . toContain ( "...(truncated)..." ) ;
1593+ const truncatedOutput = mockCallArg ( onToolResult , 19 , 0 , "onToolResult" ) as {
1594+ text ?: string ;
1595+ } ;
1596+ expect ( truncatedOutput . text ) . toContain ( "...(truncated)..." ) ;
15931597 expect ( JSON . stringify ( onToolResult . mock . calls ) ) . not . toContain (
15941598 "final output should not duplicate" ,
15951599 ) ;
0 commit comments