@@ -44,42 +44,6 @@ describe("ClaudeAdapter", () => {
4444 expect ( args ) . not . toContain ( "--resume" ) ;
4545 expect ( args ) . not . toContain ( "--continue" ) ;
4646 } ) ;
47-
48- it ( "includes --allowedTools when allowedTools are provided" , ( ) => {
49- const adapterWithTools = new ClaudeAdapter ( {
50- sessionId : "test-session-1" ,
51- worktreePath : "/tmp/worktree" ,
52- allowedTools : [ "Bash(git:*)" , "Edit" , "mcp__papershelf__*" ] ,
53- } ) ;
54- const args = adapterWithTools . buildStartArgs ( "Hello" ) ;
55- expect ( args ) . toContain ( "--allowedTools" ) ;
56- const toolsIndex = args . indexOf ( "--allowedTools" ) ;
57- expect ( args [ toolsIndex + 1 ] ) . toBe ( "Bash(git:*)" ) ;
58- expect ( args [ toolsIndex + 2 ] ) . toBe ( "Edit" ) ;
59- expect ( args [ toolsIndex + 3 ] ) . toBe ( "mcp__papershelf__*" ) ;
60- } ) ;
61-
62- it ( "omits --allowedTools when none provided" , ( ) => {
63- const args = adapter . buildStartArgs ( "Hello" ) ;
64- expect ( args ) . not . toContain ( "--allowedTools" ) ;
65- } ) ;
66-
67- it ( "includes --permission-mode when not default" , ( ) => {
68- const adapterWithPerms = new ClaudeAdapter ( {
69- sessionId : "test-session-1" ,
70- worktreePath : "/tmp/worktree" ,
71- permissionMode : "acceptEdits" ,
72- } ) ;
73- const args = adapterWithPerms . buildStartArgs ( "Hello" ) ;
74- expect ( args ) . toContain ( "--permission-mode" ) ;
75- const modeIndex = args . indexOf ( "--permission-mode" ) ;
76- expect ( args [ modeIndex + 1 ] ) . toBe ( "acceptEdits" ) ;
77- } ) ;
78-
79- it ( "omits --permission-mode when default" , ( ) => {
80- const args = adapter . buildStartArgs ( "Hello" ) ;
81- expect ( args ) . not . toContain ( "--permission-mode" ) ;
82- } ) ;
8347 } ) ;
8448
8549 describe ( "buildResumeArgs" , ( ) => {
@@ -103,20 +67,6 @@ describe("ClaudeAdapter", () => {
10367 const args = adapter . buildResumeArgs ( "Continue" ) ;
10468 expect ( args ) . not . toContain ( "--session-id" ) ;
10569 } ) ;
106-
107- it ( "includes --allowedTools on resume when provided" , ( ) => {
108- const adapterWithTools = new ClaudeAdapter ( {
109- sessionId : "test-session-1" ,
110- worktreePath : "/tmp/worktree" ,
111- allowedTools : [ "Edit" , "Read" ] ,
112- } ) ;
113- adapterWithTools . setAgentSessionId ( "claude-session-abc" ) ;
114- const args = adapterWithTools . buildResumeArgs ( "Continue" ) ;
115- expect ( args ) . toContain ( "--allowedTools" ) ;
116- const toolsIndex = args . indexOf ( "--allowedTools" ) ;
117- expect ( args [ toolsIndex + 1 ] ) . toBe ( "Edit" ) ;
118- expect ( args [ toolsIndex + 2 ] ) . toBe ( "Read" ) ;
119- } ) ;
12070 } ) ;
12171
12272 describe ( "parseLine" , ( ) => {
@@ -364,32 +314,6 @@ describe("ClaudeAdapter", () => {
364314 expect ( event ) . toBeNull ( ) ;
365315 } ) ;
366316
367- it ( "maps control_request with can_use_tool to permission_request event" , ( ) => {
368- const event = adapter . parseLine ( {
369- type : "control_request" ,
370- request_id : "req_1_abc123" ,
371- request : {
372- subtype : "can_use_tool" ,
373- tool_name : "Bash" ,
374- input : { command : "git commit -m 'fix'" } ,
375- } ,
376- } ) ;
377- expect ( event ) . not . toBeNull ( ) ;
378- expect ( event ?. type ) . toBe ( "permission_request" ) ;
379- expect ( event ?. data . requestId ) . toBe ( "req_1_abc123" ) ;
380- expect ( event ?. data . toolName ) . toBe ( "Bash" ) ;
381- expect ( event ?. data . toolInput ) . toEqual ( { command : "git commit -m 'fix'" } ) ;
382- } ) ;
383-
384- it ( "returns null for control_request with unknown subtype" , ( ) => {
385- const event = adapter . parseLine ( {
386- type : "control_request" ,
387- request_id : "req_2" ,
388- request : { subtype : "unknown_subtype" } ,
389- } ) ;
390- expect ( event ) . toBeNull ( ) ;
391- } ) ;
392-
393317 it ( "returns null for non-delta stream events we don't map" , ( ) => {
394318 const event = adapter . parseLine ( {
395319 type : "stream_event" ,
@@ -424,22 +348,5 @@ describe("ClaudeAdapter", () => {
424348 expect ( types ) . toContain ( "message_complete" ) ;
425349 expect ( types ) . toContain ( "session_end" ) ;
426350 } ) ;
427-
428- it ( "parses permission request fixture into expected events" , ( ) => {
429- const lines = loadFixtureEvents ( "claude-stream-permission.ndjson" ) ;
430- const events = adapter . parseLines ( lines ) ;
431-
432- const types = events . map ( ( e ) => e . type ) ;
433- expect ( types ) . toContain ( "session_start" ) ;
434- expect ( types ) . toContain ( "tool_use_start" ) ;
435- expect ( types ) . toContain ( "permission_request" ) ;
436- expect ( types ) . toContain ( "tool_result" ) ;
437- expect ( types ) . toContain ( "message_complete" ) ;
438- expect ( types ) . toContain ( "session_end" ) ;
439-
440- const permEvent = events . find ( ( e ) => e . type === "permission_request" ) ;
441- expect ( permEvent . data . toolName ) . toBe ( "Bash" ) ;
442- expect ( permEvent . data . requestId ) . toBe ( "req_1_abc" ) ;
443- } ) ;
444351 } ) ;
445352} ) ;
0 commit comments