@@ -92,6 +92,7 @@ describe("broadcast dispatch", () => {
9292 } ,
9393 session : {
9494 resolveStorePath : vi . fn ( ( ) => "/tmp/feishu-session-store.json" ) ,
95+ recordInboundSession : vi . fn ( ) . mockResolvedValue ( undefined ) ,
9596 } ,
9697 reply : {
9798 resolveEnvelopeFormatOptions : resolveEnvelopeFormatOptionsMock ,
@@ -109,6 +110,28 @@ describe("broadcast dispatch", () => {
109110 media : {
110111 saveMediaBuffer : mockSaveMediaBuffer ,
111112 } ,
113+ turn : {
114+ runPrepared : vi . fn (
115+ async ( turn : Parameters < PluginRuntime [ "channel" ] [ "turn" ] [ "runPrepared" ] > [ 0 ] ) => {
116+ await turn . recordInboundSession ( {
117+ storePath : turn . storePath ,
118+ sessionKey : turn . ctxPayload . SessionKey ?? turn . routeSessionKey ,
119+ ctx : turn . ctxPayload ,
120+ groupResolution : turn . record ?. groupResolution ,
121+ createIfMissing : turn . record ?. createIfMissing ,
122+ updateLastRoute : turn . record ?. updateLastRoute ,
123+ onRecordError : turn . record ?. onRecordError ?? ( ( ) => undefined ) ,
124+ } ) ;
125+ return {
126+ admission : { kind : "dispatch" as const } ,
127+ dispatched : true ,
128+ ctxPayload : turn . ctxPayload ,
129+ routeSessionKey : turn . routeSessionKey ,
130+ dispatchResult : await turn . runDispatch ( ) ,
131+ } ;
132+ } ,
133+ ) ,
134+ } ,
112135 pairing : {
113136 readAllowFromStore : vi . fn ( ) . mockResolvedValue ( [ ] ) ,
114137 upsertPairingRequest : vi . fn ( ) . mockResolvedValue ( { code : "ABCDEFGH" , created : false } ) ,
0 commit comments