File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1488,6 +1488,39 @@ describe("TriggerChatTransport", function () {
14881488 expect ( runStore . get ( "chat-reconnect-string-failure" ) ) . toBeUndefined ( ) ;
14891489 } ) ;
14901490
1491+ it ( "ignores onError callback failures during reconnect error reporting" , async function ( ) {
1492+ const runStore = new InMemoryTriggerChatRunStore ( ) ;
1493+ runStore . set ( {
1494+ chatId : "chat-reconnect-onerror-failure" ,
1495+ runId : "run_reconnect_onerror_failure" ,
1496+ publicAccessToken : "pk_reconnect_onerror_failure" ,
1497+ streamKey : "chat-stream" ,
1498+ lastEventId : "100-0" ,
1499+ isActive : true ,
1500+ } ) ;
1501+
1502+ const transport = new TriggerChatTransport ( {
1503+ task : "chat-task" ,
1504+ stream : "chat-stream" ,
1505+ accessToken : "pk_trigger" ,
1506+ runStore,
1507+ onError : async function onError ( ) {
1508+ throw new Error ( "onError failed" ) ;
1509+ } ,
1510+ } ) ;
1511+
1512+ ( transport as any ) . fetchRunStream = async function fetchRunStream ( ) {
1513+ throw new Error ( "reconnect root cause" ) ;
1514+ } ;
1515+
1516+ const stream = await transport . reconnectToStream ( {
1517+ chatId : "chat-reconnect-onerror-failure" ,
1518+ } ) ;
1519+
1520+ expect ( stream ) . toBeNull ( ) ;
1521+ expect ( runStore . get ( "chat-reconnect-onerror-failure" ) ) . toBeUndefined ( ) ;
1522+ } ) ;
1523+
14911524 it ( "cleans run store state when stream completes" , async function ( ) {
14921525 const trackedRunStore = new TrackedRunStore ( ) ;
14931526
You can’t perform that action at this time.
0 commit comments