@@ -422,6 +422,7 @@ describe("ClineProvider", () => {
422422 showRooIgnoredFiles : true ,
423423 renderContext : "sidebar" ,
424424 maxReadFileLine : 500 ,
425+ autoCondenseContext : true ,
425426 autoCondenseContextPercent : 100 ,
426427 }
427428
@@ -594,6 +595,24 @@ describe("ClineProvider", () => {
594595 expect ( state . alwaysApproveResubmit ) . toBe ( false )
595596 } )
596597
598+ test ( "autoCondenseContext defaults to true" , async ( ) => {
599+ // Mock globalState.get to return undefined for autoCondenseContext
600+ ; ( mockContext . globalState . get as jest . Mock ) . mockImplementation ( ( key : string ) =>
601+ key === "autoCondenseContext" ? undefined : null ,
602+ )
603+ const state = await provider . getState ( )
604+ expect ( state . autoCondenseContext ) . toBe ( true )
605+ } )
606+
607+ test ( "handles autoCondenseContext message" , async ( ) => {
608+ await provider . resolveWebviewView ( mockWebviewView )
609+ const messageHandler = ( mockWebviewView . webview . onDidReceiveMessage as jest . Mock ) . mock . calls [ 0 ] [ 0 ]
610+ await messageHandler ( { type : "autoCondenseContext" , bool : false } )
611+ expect ( updateGlobalStateSpy ) . toHaveBeenCalledWith ( "autoCondenseContext" , false )
612+ expect ( mockContext . globalState . update ) . toHaveBeenCalledWith ( "autoCondenseContext" , false )
613+ expect ( mockPostMessage ) . toHaveBeenCalled ( )
614+ } )
615+
597616 test ( "autoCondenseContextPercent defaults to 100" , async ( ) => {
598617 // Mock globalState.get to return undefined for autoCondenseContextPercent
599618 ; ( mockContext . globalState . get as jest . Mock ) . mockImplementation ( ( key : string ) =>
0 commit comments