summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/overview_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-26 10:11:37 +0200
committerPaul Buetow <paul@buetow.org>2026-02-26 10:11:37 +0200
commit76db79bbd74ebf58ea4403a7e623316c1e4b41de (patch)
tree20fd850131b6958d95a20aea5ae0c7d3ee3bf8de /internal/tui/dashboard/overview_test.go
parent8e7f9c656df5ab155648af316635b90dbd53f8d0 (diff)
tui: stabilize overview sparklines and prevent wrap artifacts
Diffstat (limited to 'internal/tui/dashboard/overview_test.go')
-rw-r--r--internal/tui/dashboard/overview_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/tui/dashboard/overview_test.go b/internal/tui/dashboard/overview_test.go
index 89f00fb..706661e 100644
--- a/internal/tui/dashboard/overview_test.go
+++ b/internal/tui/dashboard/overview_test.go
@@ -117,3 +117,15 @@ func TestRenderOverviewDoesNotOverflowWidth(t *testing.T) {
}
}
}
+
+func TestRenderOverviewSparklineHasSafetyMargin(t *testing.T) {
+ const panelInner = 80
+ out := renderOverviewSparkline("Latency:", []float64{1, 2, 3, 4, 5}, panelInner)
+ lines := strings.Split(out, "\n")
+ if len(lines) != 2 {
+ t.Fatalf("expected 2-line sparkline, got %q", out)
+ }
+ if got, max := lipgloss.Width(lines[0]), panelInner-sparklineSafetyMargin; got > max {
+ t.Fatalf("expected sparkline width <= %d with safety margin, got %d", max, got)
+ }
+}