@@ -17,9 +17,16 @@ import {
1717} from './persisted-message'
1818
1919describe ( 'persisted-message' , ( ) => {
20- it . each ( [ 'executing' , 'pending' , 'awaiting_approval' ] as const ) (
21- 'cancels unfinished %s tools even when the stopped marker already exists' ,
22- ( state ) => {
20+ it . each ( [
21+ { state : 'executing' , alreadyStopped : false } ,
22+ { state : 'executing' , alreadyStopped : true } ,
23+ { state : 'pending' , alreadyStopped : false } ,
24+ { state : 'pending' , alreadyStopped : true } ,
25+ { state : 'awaiting_approval' , alreadyStopped : false } ,
26+ { state : 'awaiting_approval' , alreadyStopped : true } ,
27+ ] as const ) (
28+ 'cancels $state tools (existing stopped marker: $alreadyStopped)' ,
29+ ( { state, alreadyStopped } ) => {
2330 const message : PersistedMessage = {
2431 id : 'assistant' ,
2532 role : 'assistant' ,
@@ -36,7 +43,7 @@ describe('persisted-message', () => {
3643 } ,
3744 } ,
3845 { type : 'tool' , toolCall : { id : 'finished' , name : 'read' , state : 'success' } } ,
39- { type : 'complete' , status : 'cancelled' } ,
46+ ... ( alreadyStopped ? [ { type : 'complete' as const , status : 'cancelled' as const } ] : [ ] ) ,
4047 ] ,
4148 }
4249 const saved = withStoppedContentBlock ( message )
0 commit comments