summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/model_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-06 18:33:44 +0200
committerPaul Buetow <paul@buetow.org>2026-03-06 18:33:44 +0200
commita76e81adca48fea5df4a16382ec7e7b0ab461e7f (patch)
tree633e239adddceb7ef1ca5fc3c1301fe4e1206716 /internal/tui/dashboard/model_test.go
parentb3bbf184dcdff908abbd4413c77e1455b24de0c9 (diff)
feat(tui): add files icicle visualization mode (task 383)
Diffstat (limited to 'internal/tui/dashboard/model_test.go')
-rw-r--r--internal/tui/dashboard/model_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/internal/tui/dashboard/model_test.go b/internal/tui/dashboard/model_test.go
index a92a77c..522e97e 100644
--- a/internal/tui/dashboard/model_test.go
+++ b/internal/tui/dashboard/model_test.go
@@ -385,6 +385,23 @@ func TestBubbleMetricToggleForSyscallsTab(t *testing.T) {
}
}
+func TestMetricToggleAppliesInFilesIcicleMode(t *testing.T) {
+ snap := statsengine.NewSnapshot(nil, nil, nil, nil, []statsengine.FileSnapshot{
+ {Path: "/var/log/a", Accesses: 5, BytesRead: 120, BytesWritten: 40},
+ }, nil, statsengine.HistogramSnapshot{}, statsengine.HistogramSnapshot{})
+ m := NewModelWithConfig(nil, nil, 250, common.DefaultKeyMap())
+ m.activeTab = TabFiles
+ m.latest = &snap
+ m.filesDirGrouped = true
+ m.filesVizMode = tabVizModeIcicle
+
+ next, _ := m.Update(tea.KeyPressMsg{Code: []rune{'b'}[0], Text: string([]rune{'b'})})
+ model := next.(Model)
+ if got := model.filesChart.Metric(); got != bubbleMetricBytes {
+ t.Fatalf("expected files metric toggle to bytes in icicle mode, got %q", got)
+ }
+}
+
func TestFilesBubbleRequiresDirectoryMode(t *testing.T) {
snap := statsengine.NewSnapshot(nil, nil, nil, nil, []statsengine.FileSnapshot{
{Path: "/tmp/a", Accesses: 3},
@@ -412,6 +429,12 @@ func TestFilesBubbleRequiresDirectoryMode(t *testing.T) {
t.Fatalf("expected files bubble mode enabled in directory mode")
}
+ next, _ = model.Update(tea.KeyPressMsg{Code: []rune{'v'}[0], Text: string([]rune{'v'})})
+ model = next.(Model)
+ if got := model.filesVizMode; got != tabVizModeIcicle {
+ t.Fatalf("expected files icicle mode enabled in directory mode")
+ }
+
next, _ = model.Update(tea.KeyPressMsg{Code: []rune{'d'}[0], Text: string([]rune{'d'})})
model = next.(Model)
if got := model.filesVizMode; got != tabVizModeTable {
@@ -475,6 +498,25 @@ func TestTreemapModeRendersTreemapHeader(t *testing.T) {
}
}
+func TestIcicleModeRendersFilesHeader(t *testing.T) {
+ snap := statsengine.NewSnapshot(nil, nil, nil, nil, []statsengine.FileSnapshot{
+ {Path: "/srv/log/a", Accesses: 9, BytesRead: 400, BytesWritten: 200},
+ {Path: "/srv/log/b", Accesses: 4, BytesRead: 100, BytesWritten: 40},
+ }, nil, statsengine.HistogramSnapshot{}, statsengine.HistogramSnapshot{})
+ m := NewModelWithConfig(nil, nil, 250, common.DefaultKeyMap())
+ m.activeTab = TabFiles
+ m.latest = &snap
+ m.filesDirGrouped = true
+ m.filesVizMode = tabVizModeIcicle
+ m.width = 120
+ m.height = 28
+
+ out := m.View().Content
+ if !strings.Contains(out, "Files icicle") {
+ t.Fatalf("expected icicle header in files view")
+ }
+}
+
func TestScrollOffsetDoesNotGrowUnbounded(t *testing.T) {
m := NewModelWithConfig(nil, nil, 250, common.DefaultKeyMap())
m.activeTab = TabSyscalls