hub (unreleased): review fix 7 — a test for the stuck line's guard: a row told to the operator never gets „the notice has not gone out”
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
b391a2322c
commit
cbfeeb626e
3 files changed
+44
No files matched your search
@@ -137,3 +137,35 @@ func TestReview2_ASendThatErrorsAfterItWasAcceptedIsNotMailedEveryHour(t *testin
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Finding 7. The guard `n.Told() ||` in endNoticeStuck had no test: without it the suite stayed green. A row that
|
||||
// WAS told to the operator (the household had no address then) and whose later household mail waits for the daily
|
||||
// limit has told somebody — the operator must NOT get the line „the notice has not gone out”.
|
||||
func TestReview7_ARowToldToTheOperatorNeverGetsTheStuckLine(t *testing.T) {
|
||||
r := newNoticeRig(t, "")
|
||||
r.report(repPressed)
|
||||
if n, _ := r.notice("vikunja"); n.ToldTo != store.EndNoticeOperator {
|
||||
t.Fatalf("fixture: the operator was not told: %+v", n)
|
||||
}
|
||||
// five days pass; the household now has an address, and its daily limit is used up by other notices
|
||||
old := time.Now().UTC().Add(-5 * 24 * time.Hour)
|
||||
if err := r.st.SetEndNoticeForTest("c1", "vikunja", "2026-11-15T10:00:00Z", old, old, store.EndNoticeOperator); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := r.st.SaveNotificationPrefs("c1", household, []string{}, 6); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for i := 0; i < 5; i++ {
|
||||
if err := r.st.LogNotification("c1", "offsite_end_scheduled", "info", "offsite_end_scheduled other", "sent", "", "customer"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
r.report(repPressed)
|
||||
n, _ := r.notice("vikunja")
|
||||
if n.ToldTo != store.EndNoticeOperator || !n.Told() || !strings.Contains(n.LastReason, "daily limit") {
|
||||
t.Fatalf("fixture: the household's mail must have waited for the limit, the operator's notice standing: %+v", n)
|
||||
}
|
||||
if e := r.events(offsitekeys.EventEndNoticeStuck); len(e) != 0 {
|
||||
t.Fatalf("a row that was told to the operator got the „told nobody” line: %+v", e)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user