@@ -407,8 +407,8 @@ describe("createRealtimeTranscriptionWebSocketSession", () => {
407407 expect ( closeError . message ) . toBe ( "test realtime transcription connection closed before ready" ) ;
408408 } ) ;
409409
410- it ( "delivers a legitimate large inbound frame below the payload cap" , async ( ) => {
411- // Well above any real transcript frame yet far under the 16 MiB cap: proves
410+ it ( "delivers a legitimate large inbound message below the payload cap" , async ( ) => {
411+ // Well above any real transcript message yet far under the 16 MiB cap: proves
412412 // the bound does not reject legitimate large provider traffic.
413413 const largeText = "x" . repeat ( 2 * 1024 * 1024 ) ;
414414 const server = await createRealtimeServer ( {
@@ -430,14 +430,14 @@ describe("createRealtimeTranscriptionWebSocketSession", () => {
430430 await vi . waitFor ( ( ) => {
431431 expect ( onMessage ) . toHaveBeenCalledTimes ( 1 ) ;
432432 } ) ;
433- const event = requireFirstMockArg ( onMessage , "large inbound frame " ) ;
433+ const event = requireFirstMockArg ( onMessage , "large inbound message " ) ;
434434 expect ( event ) . toEqual ( { type : "transcript" , text : largeText } ) ;
435435 session . close ( ) ;
436436 } ) ;
437437
438- it ( "drops an oversized inbound frame before it reaches the provider parser" , async ( ) => {
439- // ws rejects a frame above maxPayload with an error + 1009 close, so an
440- // oversized upstream frame never reaches onMessage/JSON parse.
438+ it ( "drops an oversized inbound message before it reaches the provider parser" , async ( ) => {
439+ // ws rejects a message above maxPayload with an error + 1009 close, so an
440+ // oversized upstream message never reaches onMessage/JSON parse.
441441 const oversized = "x" . repeat ( REALTIME_TRANSCRIPTION_WS_MAX_PAYLOAD_BYTES + 1 ) ;
442442 const server = await createRealtimeServer ( { initialText : oversized } ) ;
443443 const onError = vi . fn ( ) ;
@@ -460,8 +460,9 @@ describe("createRealtimeTranscriptionWebSocketSession", () => {
460460 expect ( onError ) . toHaveBeenCalledTimes ( 1 ) ;
461461 } ) ;
462462 expect ( onMessage ) . not . toHaveBeenCalled ( ) ;
463- const overflowError = requireFirstMockArg ( onError , "oversized inbound frame error" ) ;
463+ const overflowError = requireFirstMockArg ( onError , "oversized inbound message error" ) ;
464464 expect ( overflowError ) . toBeInstanceOf ( Error ) ;
465+ expect ( overflowError ) . toHaveProperty ( "code" , "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH" ) ;
465466 expect ( overflowError . message ) . toMatch ( / m a x p a y l o a d / i) ;
466467 session . close ( ) ;
467468 } ) ;
0 commit comments