okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

Aly Raffaufrefactor(tui): replace pick helpers with explicit branches8499f48

main
588 B27 linesraw
1// Byte-bound eviction protects long TUI transcripts beyond practical daemon E2E history.
2package tui
3
4import (
5	"strings"
6	"testing"
7)
8
9func TestBoundedHistory_ByteLimit(t *testing.T) {
10	h := NewBoundedHistory(100, 500)
11	for range 10 {
12		h.Append(HistoryEntry{
13			Kind: EntryAssistant,
14			Text: strings.Repeat("x", 100),
15		})
16	}
17
18	if h.TotalBytes() > 500 {
19		t.Fatalf("expected total bytes <= 500, got %d", h.TotalBytes())
20	}
21	if h.EvictedCount() == 0 {
22		t.Fatalf("expected evictions due to byte limit")
23	}
24	if h.EvictedBytes() == 0 {
25		t.Fatalf("expected non-zero evicted bytes")
26	}
27}