Notify when prune completes
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user