summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/model_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-08 08:59:02 +0200
committerPaul Buetow <paul@buetow.org>2026-03-08 08:59:02 +0200
commit77b993ded6e8cfa15e053a09ef79581afd0b7e4b (patch)
treed72b0a66152bfb2fd9404f47101fe7159ada33fb /internal/tui/dashboard/model_test.go
parent9950c77981ce06be34e877a6729abb23a36789c6 (diff)
dashboard: wire files icicle mode and root path labels
Diffstat (limited to 'internal/tui/dashboard/model_test.go')
-rw-r--r--internal/tui/dashboard/model_test.go27
1 files changed, 26 insertions, 1 deletions
diff --git a/internal/tui/dashboard/model_test.go b/internal/tui/dashboard/model_test.go
index 8b03b2b..5a3be89 100644
--- a/internal/tui/dashboard/model_test.go
+++ b/internal/tui/dashboard/model_test.go
@@ -402,7 +402,7 @@ func TestMetricToggleAppliesInFilesTreemapMode(t *testing.T) {
}
}
-func TestFilesTreemapRequiresDirectoryMode(t *testing.T) {
+func TestFilesVisualizationRequiresDirectoryMode(t *testing.T) {
snap := statsengine.NewSnapshot(nil, nil, nil, nil, []statsengine.FileSnapshot{
{Path: "/tmp/a", Accesses: 3},
{Path: "/tmp/b", Accesses: 1},
@@ -437,6 +437,12 @@ func TestFilesTreemapRequiresDirectoryMode(t *testing.T) {
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{'v'}[0], Text: string([]rune{'v'})})
+ model = next.(Model)
if got := model.filesVizMode; got != tabVizModeTable {
t.Fatalf("expected files mode cycled back to table")
}
@@ -523,6 +529,25 @@ func TestTreemapModeRendersFilesHeader(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 TestTreemapModeRendersProcessesHeader(t *testing.T) {
snap := statsengine.NewSnapshot(nil, nil, nil, nil, nil, []statsengine.ProcessSnapshot{
{PID: 10, Comm: "worker", Syscalls: 12, Bytes: 500},