package handlers_test import ( "testing" "github.com/StevanFreeborn/term-tier/internal/handlers" "github.com/StevanFreeborn/term-tier/internal/state" tea "github.com/charmbracelet/bubbletea" ) func TestNewTrackWindowSizeHandler(t *testing.T) { h := handlers.NewTrackWindowSizeHandler() if h == nil { t.Error("Expected NewTrackWindowSizeHandler to return a handler, got nil") } } func TestTrackWindowSizeHandler_Match(t *testing.T) { h := handlers.NewTrackWindowSizeHandler() s := state.New() msg := tea.WindowSizeMsg{Width: 100, Height: 100} if !h.Match(s, msg) { t.Error("Expected Match to return true for WindowSizeMsg") } } func TestTrackWindowSizeHandler_Handle(t *testing.T) { h := handlers.NewTrackWindowSizeHandler() s := state.New() expectedWidth := 1024 expectedHeight := 768 msg := tea.WindowSizeMsg{Width: expectedWidth, Height: expectedHeight} cmd := h.Handle(s, msg) if s.WindowWidth() != expectedWidth { t.Errorf("Expected WindowWidth to be %d, got %d", expectedWidth, s.WindowWidth()) } if s.WindowHeight() != expectedHeight { t.Errorf("Expected WindowHeight to be %d, got %d", expectedHeight, s.WindowHeight()) } if cmd != nil { t.Error("Expected Handle to return nil") } }