@@ -15,7 +15,7 @@ const THREAD =
1515
1616test ( "buildMessageLink → parseMessageLink round-trips without thread" , ( ) => {
1717 const url = buildMessageLink ( { channelId : CHANNEL , messageId : MESSAGE } ) ;
18- assert . equal ( url , `sprout ://message?channel=${ CHANNEL } &id=${ MESSAGE } ` ) ;
18+ assert . equal ( url , `buzz ://message?channel=${ CHANNEL } &id=${ MESSAGE } ` ) ;
1919
2020 const parsed = parseMessageLink ( url ) ;
2121 assert . equal ( parsed . ok , true ) ;
@@ -52,37 +52,37 @@ test("buildMessageLink treats null/empty thread as absent", () => {
5252 messageId : MESSAGE ,
5353 threadRootId : "" ,
5454 } ) ;
55- assert . equal ( a , `sprout ://message?channel=${ CHANNEL } &id=${ MESSAGE } ` ) ;
56- assert . equal ( b , `sprout ://message?channel=${ CHANNEL } &id=${ MESSAGE } ` ) ;
55+ assert . equal ( a , `buzz ://message?channel=${ CHANNEL } &id=${ MESSAGE } ` ) ;
56+ assert . equal ( b , `buzz ://message?channel=${ CHANNEL } &id=${ MESSAGE } ` ) ;
5757} ) ;
5858
5959test ( "buildMessageLink rejects missing required params" , ( ) => {
6060 assert . throws ( ( ) => buildMessageLink ( { channelId : "" , messageId : MESSAGE } ) ) ;
6161 assert . throws ( ( ) => buildMessageLink ( { channelId : CHANNEL , messageId : "" } ) ) ;
6262} ) ;
6363
64- test ( "parseMessageLink rejects non-sprout schemes" , ( ) => {
64+ test ( "parseMessageLink rejects unsupported schemes" , ( ) => {
6565 const r = parseMessageLink (
6666 `https://example.com/?channel=${ CHANNEL } &id=${ MESSAGE } ` ,
6767 ) ;
6868 assert . equal ( r . ok , false ) ;
6969 assert . equal ( r . ok === false && r . reason , "wrong-scheme" ) ;
7070} ) ;
7171
72- test ( "parseMessageLink rejects sprout :// with wrong host" , ( ) => {
73- const r = parseMessageLink ( `sprout ://connect?relay=wss://example.com` ) ;
72+ test ( "parseMessageLink rejects buzz :// with wrong host" , ( ) => {
73+ const r = parseMessageLink ( `buzz ://connect?relay=wss://example.com` ) ;
7474 assert . equal ( r . ok , false ) ;
7575 assert . equal ( r . ok === false && r . reason , "wrong-host" ) ;
7676} ) ;
7777
7878test ( "parseMessageLink rejects missing channel" , ( ) => {
79- const r = parseMessageLink ( `sprout ://message?id=${ MESSAGE } ` ) ;
79+ const r = parseMessageLink ( `buzz ://message?id=${ MESSAGE } ` ) ;
8080 assert . equal ( r . ok , false ) ;
8181 assert . equal ( r . ok === false && r . reason , "missing-channel" ) ;
8282} ) ;
8383
8484test ( "parseMessageLink rejects missing id" , ( ) => {
85- const r = parseMessageLink ( `sprout ://message?channel=${ CHANNEL } ` ) ;
85+ const r = parseMessageLink ( `buzz ://message?channel=${ CHANNEL } ` ) ;
8686 assert . equal ( r . ok , false ) ;
8787 assert . equal ( r . ok === false && r . reason , "missing-id" ) ;
8888} ) ;
@@ -93,11 +93,28 @@ test("parseMessageLink rejects malformed URL strings", () => {
9393 assert . equal ( r . ok === false && r . reason , "invalid-url" ) ;
9494} ) ;
9595
96- test ( "isMessageLink matches only sprout://message" , ( ) => {
96+ test ( "parseMessageLink accepts legacy sprout://message links" , ( ) => {
97+ const r = parseMessageLink (
98+ `sprout://message?channel=${ CHANNEL } &id=${ MESSAGE } ` ,
99+ ) ;
100+ assert . equal ( r . ok , true ) ;
101+ assert . deepEqual ( r . ok && r . value , {
102+ channelId : CHANNEL ,
103+ messageId : MESSAGE ,
104+ threadRootId : null ,
105+ } ) ;
106+ } ) ;
107+
108+ test ( "isMessageLink matches buzz://message and legacy sprout://message" , ( ) => {
109+ assert . equal (
110+ isMessageLink ( `buzz://message?channel=${ CHANNEL } &id=${ MESSAGE } ` ) ,
111+ true ,
112+ ) ;
97113 assert . equal (
98114 isMessageLink ( `sprout://message?channel=${ CHANNEL } &id=${ MESSAGE } ` ) ,
99115 true ,
100116 ) ;
117+ assert . equal ( isMessageLink ( "buzz://connect?relay=wss://x" ) , false ) ;
101118 assert . equal ( isMessageLink ( "sprout://connect?relay=wss://x" ) , false ) ;
102119 assert . equal ( isMessageLink ( "https://example.com" ) , false ) ;
103120 assert . equal ( isMessageLink ( undefined ) , false ) ;
0 commit comments