11import type { ToolResult } from './types' ;
22
33type RunAction = ( model : string , prompt : string ) => Promise < void > ;
4- type ResumeAction = ( sessionId : string ) => Promise < void > ;
4+ type ResumeAction = ( sessionId ? : string ) => Promise < void > ;
55
66const {
77 color,
@@ -105,7 +105,7 @@ describe('cli', () => {
105105 it ( 'renders TUI with no args' , async ( ) => {
106106 await main ( [ ] ) ;
107107 expect ( mockReset ) . toHaveBeenCalledOnce ( ) ;
108- expect ( renderApp ) . toHaveBeenCalledWith ( undefined ) ;
108+ expect ( renderApp ) . toHaveBeenCalledWith ( { } ) ;
109109 expect ( parse ) . not . toHaveBeenCalled ( ) ;
110110 } ) ;
111111
@@ -349,6 +349,16 @@ describe('cli', () => {
349349 expect ( process . exitCode ) . toBe ( 1 ) ;
350350 } ) ;
351351
352+ it ( 'opens the session picker when resume is called without a sessionId' , async ( ) => {
353+ await commandState . resumeAction ?.( ) ;
354+
355+ expect ( loadSession ) . not . toHaveBeenCalled ( ) ;
356+ expect ( mockReset ) . toHaveBeenCalledOnce ( ) ;
357+ expect ( renderApp ) . toHaveBeenCalledWith ( {
358+ initialScreen : 'session-manager' ,
359+ } ) ;
360+ } ) ;
361+
352362 it ( 'loads the requested session and renders the TUI for resume' , async ( ) => {
353363 loadSession . mockReturnValueOnce ( {
354364 metadata : { id : 'session-1' , directory : process . cwd ( ) } ,
@@ -359,7 +369,7 @@ describe('cli', () => {
359369
360370 expect ( loadSession ) . toHaveBeenCalledWith ( 'session-1' ) ;
361371 expect ( mockReset ) . toHaveBeenCalledOnce ( ) ;
362- expect ( renderApp ) . toHaveBeenCalledWith ( 'session-1' ) ;
372+ expect ( renderApp ) . toHaveBeenCalledWith ( { sessionId : 'session-1' } ) ;
363373 } ) ;
364374
365375 it ( 'allows resume when session has no directory field (legacy session)' , async ( ) => {
@@ -370,7 +380,7 @@ describe('cli', () => {
370380
371381 await commandState . resumeAction ?.( 'session-1' ) ;
372382
373- expect ( renderApp ) . toHaveBeenCalledWith ( 'session-1' ) ;
383+ expect ( renderApp ) . toHaveBeenCalledWith ( { sessionId : 'session-1' } ) ;
374384 expect ( writeError ) . not . toHaveBeenCalled ( ) ;
375385 } ) ;
376386
0 commit comments