@@ -3,8 +3,13 @@ import type { APIClient } from "@/browser/contexts/API";
33import { cancelCompaction } from "./handler" ;
44
55describe ( "cancelCompaction" , ( ) => {
6- test ( "interrupts without restore-to-input and enters edit mode with full text" , async ( ) => {
7- const interruptStream = mock ( ( ) => Promise . resolve ( { success : true } ) ) ;
6+ test ( "enters edit mode with full text before interrupting" , async ( ) => {
7+ const calls : string [ ] = [ ] ;
8+
9+ const interruptStream = mock ( ( ) => {
10+ calls . push ( "interrupt" ) ;
11+ return Promise . resolve ( { success : true } ) ;
12+ } ) ;
813
914 const client = {
1015 workspace : {
@@ -28,15 +33,19 @@ describe("cancelCompaction", () => {
2833 ] ,
2934 } as unknown as Parameters < typeof cancelCompaction > [ 2 ] ;
3035
31- const startEditingMessage = mock ( ( ) => undefined ) ;
36+ const startEditingMessage = mock ( ( ) => {
37+ calls . push ( "edit" ) ;
38+ return undefined ;
39+ } ) ;
3240
3341 const result = await cancelCompaction ( client , "ws-1" , aggregator , startEditingMessage ) ;
3442
3543 expect ( result ) . toBe ( true ) ;
44+ expect ( startEditingMessage ) . toHaveBeenCalledWith ( "user-1" , "/compact -t 100\nDo the thing" ) ;
3645 expect ( interruptStream ) . toHaveBeenCalledWith ( {
3746 workspaceId : "ws-1" ,
38- options : { abandonPartial : true , restoreQueuedToInput : false } ,
47+ options : { abandonPartial : true } ,
3948 } ) ;
40- expect ( startEditingMessage ) . toHaveBeenCalledWith ( "user-1 ", "/compact -t 100\nDo the thing" ) ;
49+ expect ( calls ) . toEqual ( [ "edit ", "interrupt" ] ) ;
4150 } ) ;
4251} ) ;
0 commit comments