@@ -17,9 +17,9 @@ import {
1717} from './persisted-message'
1818
1919describe ( 'persisted-message' , ( ) => {
20- it . each ( [ false , true ] ) (
21- 'cancels unfinished tools even when the stopped marker already exists: %s ' ,
22- ( alreadyStopped ) => {
20+ it . each ( [ 'executing' , 'pending' , 'awaiting_approval' ] as const ) (
21+ 'cancels unfinished %s tools even when the stopped marker already exists' ,
22+ ( state ) => {
2323 const message : PersistedMessage = {
2424 id : 'assistant' ,
2525 role : 'assistant' ,
@@ -31,12 +31,12 @@ describe('persisted-message', () => {
3131 toolCall : {
3232 id : 'unfinished' ,
3333 name : 'run_code' ,
34- state : 'executing' ,
34+ state,
3535 params : { code : 'keep me' } ,
3636 } ,
3737 } ,
3838 { type : 'tool' , toolCall : { id : 'finished' , name : 'read' , state : 'success' } } ,
39- ... ( alreadyStopped ? [ { type : 'complete' as const , status : 'cancelled' as const } ] : [ ] ) ,
39+ { type : 'complete' , status : 'cancelled' } ,
4040 ] ,
4141 }
4242 const saved = withStoppedContentBlock ( message )
@@ -47,7 +47,7 @@ describe('persisted-message', () => {
4747 } )
4848 expect ( saved . contentBlocks ?. [ 1 ] . toolCall ?. state ) . toBe ( 'success' )
4949 expect ( saved . contentBlocks ?. filter ( ( block ) => block . type === 'complete' ) ) . toHaveLength ( 1 )
50- expect ( message . contentBlocks ?. [ 0 ] . toolCall ?. state ) . toBe ( 'executing' )
50+ expect ( message . contentBlocks ?. [ 0 ] . toolCall ?. state ) . toBe ( state )
5151 }
5252 )
5353
0 commit comments