@@ -564,32 +564,6 @@ func TestEmptyState(t *testing.T) {
564564 }
565565}
566566
567- // TestChatMode verifies chat mode functionality
568- func TestChatMode (t * testing.T ) {
569- m := model .New ("/tmp/test.sock" )
570- cfg := config .DefaultConfig ()
571-
572- // Initialize with window size
573- updated , _ := m .Update (tea.WindowSizeMsg {Width : 100 , Height : 40 })
574- m = updated .(model.Model )
575-
576- // Chat should not be active initially
577- // NOTE: Chat feature is not currently implemented, skipping these checks
578- // Open chat using toggle chat key
579- // Note: Chat may fail to start in test environment due to missing dependencies
580- // The test verifies that the key is handled and UI doesn't crash
581- updated , _ = m .Update (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune (cfg .Keys .ToggleChat )})
582- m = updated .(model.Model )
583-
584- // View should remain renderable even if chat startup fails
585- view := m .View ()
586- if view == "" {
587- t .Error ("expected non-empty view after chat toggle" )
588- }
589-
590- // NOTE: Skipping chat state tests since ChatActive() is not implemented
591- }
592-
593567// TestLeaderKeyMode verifies leader key functionality
594568func TestLeaderKeyMode (t * testing.T ) {
595569 m := model .New ("/tmp/test.sock" )
@@ -709,99 +683,6 @@ func TestPlanModeNavigation(t *testing.T) {
709683 }
710684}
711685
712- // TestChatPanelWithTeatest uses teatest to simulate an interactive TTY session
713- // This test validates the chat panel UI with proper TTY simulation
714- func TestChatPanelWithTeatest (t * testing.T ) {
715- // Create a model with a mock socket path
716- m := model .New ("/tmp/test.sock" )
717-
718- // Create teatest environment with fixed terminal size
719- tm := teatest .NewTestModel (t , m ,
720- teatest .WithInitialTermSize (100 , 40 ),
721- )
722-
723- // Wait for initial output (should show the TUI)
724- teatest .WaitFor (t , tm .Output (), func (bts []byte ) bool {
725- return len (bts ) > 0 && bytes .Contains (bts , []byte ("/" ))
726- }, teatest .WithCheckInterval (time .Millisecond * 100 ), teatest .WithDuration (time .Second * 2 ))
727-
728- // Send 'c' key to open chat panel
729- cfg := config .DefaultConfig ()
730- tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune (cfg .Keys .ToggleChat )})
731-
732- // Wait for chat panel indicators in output
733- teatest .WaitFor (t , tm .Output (), func (bts []byte ) bool {
734- // Look for chat-related UI elements
735- return bytes .Contains (bts , []byte ("Chat" )) ||
736- bytes .Contains (bts , []byte ("chat" )) ||
737- bytes .Contains (bts , []byte ("Send" ))
738- }, teatest .WithCheckInterval (time .Millisecond * 100 ), teatest .WithDuration (time .Second * 1 ))
739-
740- // Send escape to close chat
741- tm .Send (tea.KeyMsg {Type : tea .KeyEsc })
742-
743- // Wait a bit for the close to take effect
744- time .Sleep (time .Millisecond * 100 )
745-
746- // Send 'q' to quit the program
747- tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune {'q' }})
748-
749- // Wait for program to finish
750- tm .WaitFinished (t , teatest .WithFinalTimeout (time .Second * 2 ))
751-
752- // Get final model and assert chat is closed
753- fm := tm .FinalModel (t )
754- finalModel , ok := fm .(model.Model )
755- if ! ok {
756- t .Fatalf ("final model is not model.Model: %T" , fm )
757- }
758-
759- // After closing chat, the model should still be valid
760- _ = finalModel
761- }
762-
763- // TestChatInputWithTeatest tests typing in the chat input field via TTY simulation
764- func TestChatInputWithTeatest (t * testing.T ) {
765- m := model .New ("/tmp/test.sock" )
766- cfg := config .DefaultConfig ()
767-
768- tm := teatest .NewTestModel (t , m ,
769- teatest .WithInitialTermSize (100 , 40 ),
770- )
771-
772- // Wait for initial render
773- teatest .WaitFor (t , tm .Output (), func (bts []byte ) bool {
774- return len (bts ) > 0
775- }, teatest .WithCheckInterval (time .Millisecond * 100 ), teatest .WithDuration (time .Second * 1 ))
776-
777- // Open chat (may fail in test environment due to missing dependencies)
778- tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune (cfg .Keys .ToggleChat )})
779- time .Sleep (time .Millisecond * 50 )
780-
781- // Type some text
782- testInput := "hello"
783- for _ , r := range testInput {
784- tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune {r }})
785- }
786-
787- // Try to wait for output to reflect the input
788- // If chat didn't start (due to missing dependencies), we'll just close after a delay
789- time .Sleep (time .Millisecond * 200 )
790-
791- // Close chat (if it started)
792- tm .Send (tea.KeyMsg {Type : tea .KeyEsc })
793-
794- // Send 'q' to quit the program
795- tm .Send (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune {'q' }})
796-
797- // Wait for program to finish
798- tm .WaitFinished (t , teatest .WithFinalTimeout (time .Second * 2 ))
799-
800- // Get final model state
801- fm := tm .FinalModel (t )
802- _ = fm .(model.Model )
803- }
804-
805686// TestLeaderKeyWithTeatest tests leader key mode with TTY simulation
806687func TestLeaderKeyWithTeatest (t * testing.T ) {
807688 m := model .New ("/tmp/test.sock" )
@@ -889,30 +770,3 @@ func TestLeaderKeyTimeout(t *testing.T) {
889770 t .Error ("expected non-empty view after leader timeout" )
890771 }
891772}
892-
893- // TestChatInput verifies chat input field works
894- func TestChatInput (t * testing.T ) {
895- m := model .New ("/tmp/test.sock" )
896- cfg := config .DefaultConfig ()
897-
898- // Initialize with window size
899- updated , _ := m .Update (tea.WindowSizeMsg {Width : 100 , Height : 40 })
900- m = updated .(model.Model )
901-
902- // Open chat
903- updated , _ = m .Update (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune (cfg .Keys .ToggleChat )})
904- m = updated .(model.Model )
905-
906- // Type some text
907- testInput := "hello world"
908- for _ , r := range testInput {
909- updated , _ = m .Update (tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune {r }})
910- m = updated .(model.Model )
911- }
912-
913- // View should still render
914- view := m .View ()
915- if view == "" {
916- t .Error ("expected non-empty view after typing in chat" )
917- }
918- }
0 commit comments