// SPDX-License-Identifier: AGPL-3.0-or-later package directory import ( "testing" "time" ) func TestVerificationRunsOutAtItsEnd(t *testing.T) { now := time.Date(2026, 11, 16, 12, 0, 0, 0, time.UTC) cases := []struct { until string want bool }{ {"", false}, // no end {pbTime(now.Add(time.Hour)), false}, {pbTime(now), true}, {pbTime(now.Add(-24 * time.Hour)), true}, {"not a time", false}, } for _, c := range cases { if got := verificationExpired(c.until, now); got != c.want { t.Errorf("verificationExpired(%q) = %v, want %v", c.until, got, c.want) } } } func TestVerifyExpiredOutranksOtherReasons(t *testing.T) { e := event{to: map[string]string{}} e.add("u1", NotifyComment) e.add("u1", NotifyVerifyExpired) if e.to["u1"] != NotifyVerifyExpired { t.Errorf("got %q", e.to["u1"]) } }