fix issues TUI display reliability
Build and Publish / Metadata (push) Successful in 10s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 2m0s

This commit is contained in:
mats committed 2026-09-24 11:11:29 +02:00
1 parent a96e95212a
commit f5015581a4
5 files changed
+84 -5

No files matched your search

+23
View File
@@ -251,3 +251,26 @@ func TestBarAndMinimal(t *testing.T) {
t.Fatalf("minimal render should surface scan errors, got %q", got)
}
}
func TestModelKeepsLastGoodSnapshotOnScanError(t *testing.T) {
m := newModel(nil, modelConfig{Interval: time.Minute})
good := snapshot{ScannedAt: time.Now(), Issues: []issueView{{}}}
updated, _ := m.Update(snapshotMsg(good))
m = updated.(model)
failed := snapshot{Err: context.DeadlineExceeded}
updated, _ = m.Update(snapshotMsg(failed))
m = updated.(model)
if len(m.snap.Issues) != 1 {
t.Fatalf("failed scan should not erase the last good snapshot: %+v", m.snap)
}
if m.scanErr == nil {
t.Fatal("failed scan should be visible separately from the last good snapshot")
}
updated, _ = m.Update(snapshotMsg(snapshot{ScannedAt: time.Now()}))
m = updated.(model)
if m.scanErr != nil {
t.Fatal("successful scan should clear the previous scan error")
}
}