@@ -102,25 +102,6 @@ describe("createDiscordGatewayPlugin", () => {
102102 } ) ;
103103 }
104104
105- function containsLoneSurrogate ( value : string ) : boolean {
106- for ( let index = 0 ; index < value . length ; index += 1 ) {
107- const code = value . charCodeAt ( index ) ;
108- if ( code >= 0xd800 && code <= 0xdbff ) {
109- const next = value . charCodeAt ( index + 1 ) ;
110- if ( ! ( next >= 0xdc00 && next <= 0xdfff ) ) {
111- return true ;
112- }
113- }
114- if ( code >= 0xdc00 && code <= 0xdfff ) {
115- const previous = value . charCodeAt ( index - 1 ) ;
116- if ( ! ( previous >= 0xd800 && previous <= 0xdbff ) ) {
117- return true ;
118- }
119- }
120- }
121- return false ;
122- }
123-
124105 it ( "omits GuildVoiceStates by default for text-only Discord configs" , ( ) => {
125106 expect ( resolveDiscordGatewayIntents ( ) & GatewayIntents . GuildVoiceStates ) . toBe ( 0 ) ;
126107 } ) ;
@@ -399,10 +380,10 @@ describe("createDiscordGatewayPlugin", () => {
399380
400381 createdSocket . emit ( "close" , 1008 , Buffer . from ( `${ "A" . repeat ( 239 ) } 🧪 tail` ) ) ;
401382
402- const logs = runtime . log . mock . calls . map ( ( call ) => String ( call [ 0 ] ) ) . join ( "\n" ) ;
403- expect ( logs ) . toContain ( "discord: gateway websocket closed" ) ;
404- expect ( logs ) . toContain ( "code=1008" ) ;
405- expect ( containsLoneSurrogate ( logs ) ) . toBe ( false ) ;
406- expect ( logs ) . not . toContain ( "� " ) ;
383+ const log = String ( runtime . log . mock . calls . at ( - 1 ) ?. [ 0 ] ) ;
384+ expect ( log ) . toContain ( "discord: gateway websocket closed" ) ;
385+ expect ( log ) . toContain ( "code=1008" ) ;
386+ expect ( log ) . toContain ( `reason= ${ "A" . repeat ( 239 ) } ...` ) ;
387+ expect ( log ) . toContain ( "hint=possible ws receiver buffered-parts limit " ) ;
407388 } ) ;
408389} ) ;
0 commit comments