@@ -697,6 +697,7 @@ describe("TriggerChatTransport", function () {
697697 it ( "supports creating transport with factory function" , async function ( ) {
698698 let observedRunId : string | undefined ;
699699 let callbackCompleted = false ;
700+ let observedState : TriggerChatRunState | undefined ;
700701
701702 const server = await startServer ( function ( req , res ) {
702703 if ( req . method === "POST" && req . url === "/api/v1/tasks/chat-task/trigger" ) {
@@ -738,6 +739,7 @@ describe("TriggerChatTransport", function () {
738739 onTriggeredRun : async function onTriggeredRun ( state ) {
739740 await sleep ( 1 ) ;
740741 observedRunId = state . runId ;
742+ observedState = { ...state } ;
741743 callbackCompleted = true ;
742744 } ,
743745 } ) ;
@@ -754,6 +756,13 @@ describe("TriggerChatTransport", function () {
754756 expect ( chunks ) . toHaveLength ( 2 ) ;
755757 expect ( observedRunId ) . toBe ( "run_factory" ) ;
756758 expect ( callbackCompleted ) . toBe ( true ) ;
759+ expect ( observedState ) . toMatchObject ( {
760+ chatId : "chat-factory" ,
761+ runId : "run_factory" ,
762+ streamKey : "chat-stream" ,
763+ lastEventId : undefined ,
764+ isActive : true ,
765+ } ) ;
757766 } ) ;
758767
759768 it ( "continues streaming when onTriggeredRun callback throws" , async function ( ) {
0 commit comments