summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/overview_test.go
diff options
context:
space:
mode:
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)
+ }
+}