gostations/internal/ui/ui_test.go
Greg Gauthier ec5db53b8e
Some checks failed
gobuild / build (push) Failing after 4s
feat(cli): default to bubbles TUI, add find/play subcmds + JSON favorites
- implement internal/ui with bubbles list + ★ fav markers, filter, enter stub
- add data/favorites (JSON roundtrip, Add/Remove, XDG), config tests
- wire subcommands: `find -j`, `play [url|search]`
- gate legacy wmenu behind --legacy; keep old flags for seeding
- fix inverted -short guards, format string, go.mod deps
- add unit tests for radio prune, player IsInstalled, ui keys, etc.
2026-06-05 21:23:11 +01:00

30 lines
635 B
Go

package ui
import (
"testing"
tea "github.com/charmbracelet/bubbletea"
"github.com/gmgauthier/gostations/internal/radio"
)
func TestApp_BasicKeyHandling(t *testing.T) {
app := NewApp([]radio.Station{
{Name: "Test1", Url: "http://a", Codec: "MP3", Bitrate: "128"},
})
// Send q
model, cmd := app.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'q'}})
if !model.(*App).quitting {
t.Error("q did not set quitting")
}
_ = cmd
// Send window size
model, _ = app.Update(tea.WindowSizeMsg{Width: 80, Height: 24})
a := model.(*App)
if a.list.Width() == 0 {
t.Log("list size not updated (may be ok in test)")
}
}