From 9d7b5ce9aa01e73b02cddc54dde5fbbf50b47bff Mon Sep 17 00:00:00 2001 From: Ancil Maxwell Hoffman Date: Tue, 29 Sep 2026 16:28:57 +0200 Subject: [PATCH] Label notifications posted while running unit tests The tests run inside the app and simulate installing Xcode "0.0", so every run posted notifications like "0.0 (2/7) Downloading" that looked like a real install. Prefix their title with "Test:" when running under XCTest. Co-Authored-By: Claude Opus 5.5 --- Xcodes/Backend/NotificationManager.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Xcodes/Backend/NotificationManager.swift b/Xcodes/Backend/NotificationManager.swift index 4b5fb8c3..50ef5f9b 100644 --- a/Xcodes/Backend/NotificationManager.swift +++ b/Xcodes/Backend/NotificationManager.swift @@ -154,9 +154,11 @@ public final class NotificationManager: NSObject, UNUserNotificationCenterDelega } func scheduleNotification(title: String?, body: String, category: XcodesNotificationCategory) { - let content = UNMutableNotificationContent() - if let title = title { + // Unit tests run inside the app and simulate installing Xcode "0.0"; label those so they aren't mistaken for real installs. + if isTesting { + content.title = ["Test", title].compactMap { $0 }.joined(separator: ": ") + } else if let title = title { content.title = title } content.body = body