backup tile: unknown size shows a dash, not 0 B (R-517 follow-up, measured on 9201)
gates / gates (push) Successful in 14s
gates / gates (push) Successful in 14s
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -74,4 +76,24 @@ func TestBuildTierViews_SuccessFromStorageAfterRestart(t *testing.T) {
|
||||
if !v.HasBackup || v.Due || v.Tiers[0].SizeKnown {
|
||||
t.Fatalf("after restart: want the local success shown, up to date, size unknown: %+v / due=%v", v.Tiers[0], v.Due)
|
||||
}
|
||||
// MEASURED LIVE 2026-09-15 on 9201: the top card printed „0 B" for this state.
|
||||
// RED-PROOF (run 2026-09-15, recorded in REPORT.md): without `v.SizeUnknown = !tv.SizeKnown`
|
||||
// this failed at "tile would print a size it does not know".
|
||||
if !v.SizeUnknown {
|
||||
t.Fatal("tile would print a size it does not know (0 B) for a success read back from storage")
|
||||
}
|
||||
}
|
||||
|
||||
// The rendered tile says „–", not „0 B", when the size is unknown.
|
||||
func TestBackupTile_UnknownSizeRendersDash(t *testing.T) {
|
||||
s := securityHarness(t)
|
||||
s.loadTemplates()
|
||||
v := &guestBackupView{Available: true, HasBackup: true, Success: true, SizeUnknown: true, Target: "Helyi tároló (local)"}
|
||||
var buf bytes.Buffer
|
||||
if err := s.tmpl.ExecuteTemplate(&buf, "backups", map[string]interface{}{"Page": "backups", "Title": "t", "GuestBackup": v, "Backup": map[string]interface{}{}}); err != nil {
|
||||
t.Skipf("backups page needs more data than this harness gives: %v", err)
|
||||
}
|
||||
if strings.Contains(buf.String(), ">0 B<") {
|
||||
t.Fatal("unknown size rendered as 0 B")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user