@@ -30,7 +30,7 @@ describe("getFeishuSequentialKey", () => {
3030 [ createTextEvent ( { text : "hello" } ) , "feishu:default:oc_dm_chat" ] ,
3131 [ createTextEvent ( { text : "/status" } ) , "feishu:default:oc_dm_chat" ] ,
3232 [ createTextEvent ( { text : "/stop" } ) , "feishu:default:oc_dm_chat:control" ] ,
33- [ createTextEvent ( { text : "/btw what changed?" } ) , "feishu:default:oc_dm_chat:btw:om_message_1 " ] ,
33+ [ createTextEvent ( { text : "/btw what changed?" } ) , "feishu:default:oc_dm_chat:btw" ] ,
3434 ] ) ( "resolves sequential key %#" , ( event , expected ) => {
3535 expect (
3636 getFeishuSequentialKey ( {
@@ -40,6 +40,24 @@ describe("getFeishuSequentialKey", () => {
4040 ) . toBe ( expected ) ;
4141 } ) ;
4242
43+ it ( "keeps /btw on a stable per-chat lane across different message ids" , ( ) => {
44+ const first = createTextEvent ( { text : "/btw one" , messageId : "om_message_1" } ) ;
45+ const second = createTextEvent ( { text : "/btw two" , messageId : "om_message_2" } ) ;
46+
47+ expect (
48+ getFeishuSequentialKey ( {
49+ accountId : "default" ,
50+ event : first ,
51+ } ) ,
52+ ) . toBe ( "feishu:default:oc_dm_chat:btw" ) ;
53+ expect (
54+ getFeishuSequentialKey ( {
55+ accountId : "default" ,
56+ event : second ,
57+ } ) ,
58+ ) . toBe ( "feishu:default:oc_dm_chat:btw" ) ;
59+ } ) ;
60+
4361 it ( "falls back to a stable btw lane when the message id is unavailable" , ( ) => {
4462 const event = createTextEvent ( { text : "/btw what changed?" } ) ;
4563 delete ( event . message as { message_id ?: string } ) . message_id ;
0 commit comments