summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/model_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-24 09:45:02 +0200
committerPaul Buetow <paul@buetow.org>2026-02-24 09:45:02 +0200
commitf2d79f6459bbe1aa9bae2946e9773141cb184463 (patch)
treee683b901d2432ac7e28cd6e80f468da38edc280b /internal/tui/dashboard/model_test.go
parent7fc16d6c98feae7aaee58666dc552384ceb4895e (diff)
tui: wire full dashboard tabs and improve overview summaries
Diffstat (limited to 'internal/tui/dashboard/model_test.go')
-rw-r--r--internal/tui/dashboard/model_test.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/internal/tui/dashboard/model_test.go b/internal/tui/dashboard/model_test.go
index 1d2329d..11cfc2b 100644
--- a/internal/tui/dashboard/model_test.go
+++ b/internal/tui/dashboard/model_test.go
@@ -5,7 +5,7 @@ import (
"testing"
"ior/internal/statsengine"
- "ior/internal/tui"
+ common "ior/internal/tui/common"
"ior/internal/tui/messages"
tea "github.com/charmbracelet/bubbletea"
@@ -22,7 +22,7 @@ func (f *fakeSnapshotSource) Snapshot() *statsengine.Snapshot {
}
func TestKeySwitchingChangesActiveTab(t *testing.T) {
- m := NewModelWithConfig(nil, 250, tui.DefaultKeyMap())
+ m := NewModelWithConfig(nil, 250, common.DefaultKeyMap())
next, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'2'}})
model := next.(Model)
@@ -44,7 +44,7 @@ func TestKeySwitchingChangesActiveTab(t *testing.T) {
}
func TestSyscallsTabScrollsWithJK(t *testing.T) {
- m := NewModelWithConfig(nil, 250, tui.DefaultKeyMap())
+ m := NewModelWithConfig(nil, 250, common.DefaultKeyMap())
m.activeTab = TabSyscalls
next, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'j'}})
@@ -61,7 +61,7 @@ func TestSyscallsTabScrollsWithJK(t *testing.T) {
}
func TestProcessesTabScrollsWithJK(t *testing.T) {
- m := NewModelWithConfig(nil, 250, tui.DefaultKeyMap())
+ m := NewModelWithConfig(nil, 250, common.DefaultKeyMap())
m.activeTab = TabProcesses
next, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'j'}})
@@ -78,7 +78,7 @@ func TestProcessesTabScrollsWithJK(t *testing.T) {
}
func TestFilesTabScrollsWithJK(t *testing.T) {
- m := NewModelWithConfig(nil, 250, tui.DefaultKeyMap())
+ m := NewModelWithConfig(nil, 250, common.DefaultKeyMap())
m.activeTab = TabFiles
next, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'j'}})
@@ -97,7 +97,7 @@ func TestFilesTabScrollsWithJK(t *testing.T) {
func TestRefreshTickEmitsStatsTickMsg(t *testing.T) {
snap := &statsengine.Snapshot{TotalSyscalls: 9}
engine := &fakeSnapshotSource{snap: snap}
- m := NewModelWithConfig(engine, 100, tui.DefaultKeyMap())
+ m := NewModelWithConfig(engine, 100, common.DefaultKeyMap())
next, cmd := m.Update(refreshTickMsg{})
if cmd == nil {
@@ -139,11 +139,14 @@ func TestStatsTickMsgUpdatesLatestSnapshot(t *testing.T) {
}
func TestViewRendersTabBarAndHelp(t *testing.T) {
- m := NewModelWithConfig(nil, 1000, tui.DefaultKeyMap())
+ m := NewModelWithConfig(nil, 1000, common.DefaultKeyMap())
out := m.View()
if !strings.Contains(out, "Overview") {
t.Fatalf("expected overview label in view")
}
+ if !strings.Contains(out, "Press ? for help") {
+ t.Fatalf("expected inline help hint in view")
+ }
if !strings.Contains(out, "tab next tab") {
t.Fatalf("expected help bar text in view")
}