@@ -290,59 +290,6 @@ defmodule LightningWeb.AiAssistant.ComponentTest do
290290 end
291291 end
292292
293- describe "streaming error handling" do
294- # Note: These tests document the expected error messages from SSEStream.
295- # Full integration testing would require LiveView test or E2E tests.
296- # The error handling logic is tested at the unit level in
297- # sse_stream_test.exs
298-
299- test "SSEStream broadcasts user-friendly error messages" do
300- # Document expected error messages that SSEStream broadcasts
301- error_cases = [
302- { :timeout , "Connection timed out" } ,
303- { :closed , "Connection closed unexpectedly" } ,
304- { { :shutdown , "reason" } , "Server shut down" } ,
305- { { :http_error , 500 } , "Server returned error status 500" } ,
306- { :econnrefused , "Connection error" }
307- ]
308-
309- for { _reason , expected_message } <- error_cases do
310- # These are the error messages that
311- # SSEStream.handle_info({:sse_error, reason}, state)
312- # will broadcast, which the Component then displays to users
313- assert expected_message != nil
314- end
315- end
316-
317- test "error events from Apollo are parsed correctly" do
318- # Document that SSEStream handles JSON error events from Apollo
319- error_json = Jason . encode! ( % { "message" => "Python syntax error" } )
320-
321- # SSEStream parses this and broadcasts "Python syntax error"
322- { :ok , parsed } = Jason . decode ( error_json )
323- assert parsed [ "message" ] == "Python syntax error"
324- end
325-
326- test "component implements retry and cancel handlers" do
327- # Document that the component implements retry_streaming and
328- # cancel_streaming handlers
329- # These are defined in lib/lightning_web/live/ai_assistant/component.ex
330-
331- # retry_streaming: resubmits the last user message
332- # cancel_streaming: clears the error state and cancels the
333- # pending message
334-
335- # The handlers are implemented via handle_event/3 callbacks
336- # Actual behavior testing requires full LiveView test setup or E2E
337- # tests
338-
339- # Verify the module is a LiveComponent
340- assert LightningWeb.AiAssistant.Component . __info__ ( :attributes )
341- |> Keyword . get ( :behaviour , [ ] )
342- |> Enum . member? ( Phoenix.LiveComponent )
343- end
344- end
345-
346293 describe "streaming update handlers" do
347294 setup do
348295 user = insert ( :user )
0 commit comments