v0.297.0: burn-down round 2 — 24 small rows (R-591 R-568 R-567 R-363 R-547 R-10 R-552 R-251 R-104 R-619 R-362 R-675 R-256 R-257 R-240 R-365 R-425 R-565 R-564 R-603 R-454 R-208 R-457-swept) + the banner countdown and deepCopyStack twins; MinAgent 0.131.0
gates / gates (push) Failing after 50s
gates / gates (push) Failing after 50s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.dooplex.hu/admin/felhom-controller/internal/settings"
|
||||
)
|
||||
|
||||
// R-365: with the abandonment's due moment PASSED but the daily sweep not yet run (up to ~29 h), the
|
||||
// card read „A kérésed szerint a korábbi távoli mentéseidet 2026-08-20 napján véglegesen töröljük" on
|
||||
// 2026-08-21 — a past date in the future tense. The consequence asserted, through the real handler and
|
||||
// a real countdown read from settings: an overdue countdown renders the overdue sentence (due since the
|
||||
// date, runs at the next daily maintenance) and not the future-tense one; a running countdown still
|
||||
// renders the future-tense one (negative control).
|
||||
func TestR365_OverdueCountdownIsNotFutureTense(t *testing.T) {
|
||||
render := func(t *testing.T, due time.Time) string {
|
||||
f := newRecoveryFixture(t)
|
||||
if err := f.sett.SetOffboxTarget(&settings.OffboxTarget{
|
||||
Enabled: true, Host: "nas.local", Port: 22, User: "felhom", RepoPath: "/srv/repo",
|
||||
Schedule: "daily", EscrowState: "escrowed",
|
||||
AbandonAt: due.UTC().Format(time.RFC3339), AbandonStartedAt: due.Add(-30 * 24 * time.Hour).UTC().Format(time.RFC3339),
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rr := httptest.NewRecorder()
|
||||
f.s.backupsRemoteHandler(rr, httptest.NewRequest(http.MethodGet, "/backups/remote", nil))
|
||||
if rr.Code != http.StatusOK {
|
||||
t.Fatalf("status %d", rr.Code)
|
||||
}
|
||||
return rr.Body.String()
|
||||
}
|
||||
|
||||
overdue := time.Now().Add(-20 * time.Hour)
|
||||
html := render(t, overdue)
|
||||
date := overdue.UTC().Format("2006-01-02")
|
||||
if !strings.Contains(html, "óta esedékes") || !strings.Contains(html, date) {
|
||||
t.Errorf("R-365: an overdue countdown does not say the deletion is due since %s", date)
|
||||
}
|
||||
if strings.Contains(html, "napján véglegesen töröljük") {
|
||||
t.Errorf("R-365: an overdue countdown still renders a past date in the future tense")
|
||||
}
|
||||
|
||||
running := render(t, time.Now().Add(3*24*time.Hour))
|
||||
if !strings.Contains(running, "napján véglegesen töröljük") || strings.Contains(running, "óta esedékes") {
|
||||
t.Errorf("a running countdown must keep the future-tense sentence")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user