Notify when prune completes

This commit is contained in:
Mikei386
2026-06-22 21:19:41 +02:00
parent 91089328ce
commit 99e2753c10
8 changed files with 45 additions and 11 deletions
+15
View File
@@ -27,3 +27,18 @@ func TestNotificationTitleIncludesRepositoryAndStatus(t *testing.T) {
t.Fatalf("title = %q", title)
}
}
func TestNotificationMessageIncludesPruneSummary(t *testing.T) {
started := time.Date(2026, 6, 22, 3, 0, 0, 0, time.UTC)
finished := started.Add(42 * time.Second)
run := model.Run{TaskType: "prune", Status: "success", StartedAt: &started, FinishedAt: &finished, Message: "prune completed"}
message := notificationMessage("Repository-Bereinigung", "LV-426", run, finished)
for _, expected := range []string{"🧹 Prune-Zusammenfassung", "📦 Repository: LV-426", "🗂️ Job: Repository-Bereinigung", "⏱️ Dauer: 42 Sekunden", "🔐 Ziel: Restic Repository", "✅ Status: Erfolgreich"} {
if !strings.Contains(message, expected) {
t.Errorf("message %q does not contain %q", message, expected)
}
}
if strings.Contains(message, "⚠️ Details: prune completed") {
t.Fatalf("message contains redundant prune completion details: %q", message)
}
}