Enrich backup notifications
This commit is contained in:
@@ -12,10 +12,18 @@ func TestNotificationMessageIncludesBackupStatistics(t *testing.T) {
|
||||
started := time.Date(2026, 6, 14, 12, 0, 0, 0, time.UTC)
|
||||
finished := started.Add(2*time.Minute + 8*time.Second)
|
||||
run := model.Run{TaskType: "backup", Status: "success", StartedAt: &started, FinishedAt: &finished, SnapshotID: "abc123", BytesAdded: 1536, FilesNew: 7, FilesChanged: 2, BytesProcessed: 5 * 1024 * 1024, FilesProcessed: 120}
|
||||
message := notificationMessage(run, finished)
|
||||
for _, expected := range []string{"Status: Erfolgreich", "Dauer: 2 Min. 8 Sek.", "Neu gespeichert: 1.5 KiB", "Neue Dateien: 7", "Geänderte Dateien: 2", "Gesamtgröße dieses Backups: 5.0 MiB", "Dateien insgesamt: 120", "Snapshot: abc123"} {
|
||||
message := notificationMessage("Freigaben", "LV-426", run, finished)
|
||||
for _, expected := range []string{"📊 URBM-Zusammenfassung", "Status: Erfolgreich", "Job: Freigaben", "Repository: LV-426", "Dauer: 2 Min. 8 Sek.", "Snapshot: abc123", "Verarbeitete Daten: 5.0 MiB", "Verarbeitete Dateien: 120", "Neu gespeichert: 1.5 KiB", "Neue Dateien: 7", "Geänderte Dateien: 2"} {
|
||||
if !strings.Contains(message, expected) {
|
||||
t.Errorf("message %q does not contain %q", message, expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotificationTitleIncludesRepositoryAndStatus(t *testing.T) {
|
||||
run := model.Run{TaskType: "backup", Status: "failed"}
|
||||
title := notificationTitle("Freigaben", "LV-426", run)
|
||||
if title != "❌ URBM Backup: LV-426" {
|
||||
t.Fatalf("title = %q", title)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user