Stabilize unit and UI tests for SportsTime

This commit is contained in:
treyt
2026-02-18 13:00:15 -06:00
parent 1488be7c1f
commit 20ac1a7e59
49 changed files with 432 additions and 325 deletions

View File

@@ -41,6 +41,7 @@ enum UIDesignStyle: String, CaseIterable, Identifiable, Codable {
// MARK: - Design Style Manager
@Observable
@MainActor
final class DesignStyleManager {
static let shared = DesignStyleManager()

View File

@@ -556,6 +556,15 @@ final class CanonicalSport {
}
}
// MARK: - Sendable Conformance
// These SwiftData models are passed across actor boundaries during sync operations.
// Access is still coordinated by SwiftData contexts and higher-level sync orchestration.
extension StadiumAlias: @unchecked Sendable {}
extension TeamAlias: @unchecked Sendable {}
extension LeagueStructureModel: @unchecked Sendable {}
extension CanonicalSport: @unchecked Sendable {}
// MARK: - Bundled Data Timestamps
/// Timestamps for bundled data files.

View File

@@ -78,8 +78,9 @@ final class LocationPermissionManager: NSObject {
extension LocationPermissionManager: CLLocationManagerDelegate {
nonisolated func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
let newStatus = manager.authorizationStatus
Task { @MainActor in
self.authorizationStatus = manager.authorizationStatus
self.authorizationStatus = newStatus
self.isRequestingPermission = false
// Auto-request location if newly authorized

View File

@@ -7,6 +7,8 @@ import Foundation
import CoreLocation
import MapKit
extension MKPolyline: @unchecked Sendable {}
actor LocationService {
static let shared = LocationService()
@@ -158,7 +160,7 @@ actor LocationService {
// MARK: - Route Info
struct RouteInfo {
struct RouteInfo: @unchecked Sendable {
let distance: CLLocationDistance // meters
let expectedTravelTime: TimeInterval // seconds
let polyline: MKPolyline?

View File

@@ -8,7 +8,7 @@
import Foundation
nonisolated final class SyncLogger {
final class SyncLogger: @unchecked Sendable {
static let shared = SyncLogger()
private let fileURL: URL

View File

@@ -108,7 +108,7 @@ final class VisitPhotoService {
try modelContext.save()
// Queue background upload
Task.detached { [weak self] in
Task { [weak self] in
await self?.uploadPhoto(metadata: metadata, image: image)
}

View File

@@ -63,7 +63,7 @@ enum AppTheme: String, CaseIterable, Identifiable {
// MARK: - Theme Manager
@Observable
final class ThemeManager {
final class ThemeManager: @unchecked Sendable {
static let shared = ThemeManager()
var currentTheme: AppTheme {
@@ -129,7 +129,7 @@ enum AppearanceMode: String, CaseIterable, Identifiable {
// MARK: - Appearance Manager
@Observable
final class AppearanceManager {
final class AppearanceManager: @unchecked Sendable {
static let shared = AppearanceManager()
var currentMode: AppearanceMode {

View File

@@ -821,7 +821,7 @@ final class ExportService {
trip: Trip,
games: [String: RichGame],
itineraryItems: [ItineraryItem]? = nil,
progressCallback: ((PDFAssetPrefetcher.PrefetchProgress) async -> Void)? = nil
progressCallback: (@Sendable (PDFAssetPrefetcher.PrefetchProgress) async -> Void)? = nil
) async throws -> URL {
// Prefetch all assets
let assets = await assetPrefetcher.prefetchAssets(

View File

@@ -64,7 +64,7 @@ actor PDFAssetPrefetcher {
func prefetchAssets(
for trip: Trip,
games: [String: RichGame],
progressCallback: ((PrefetchProgress) async -> Void)? = nil
progressCallback: (@Sendable (PrefetchProgress) async -> Void)? = nil
) async -> PrefetchedAssets {
var progress = PrefetchProgress()

View File

@@ -511,13 +511,6 @@ final class ItineraryTableViewController: UITableViewController {
ItineraryReorderingLogic.travelRow(in: flatItems, forDay: day)
}
deinit {
#if DEBUG
displayLink?.invalidate()
displayLink = nil
#endif
}
// MARK: - Marketing Video Auto-Scroll
#if DEBUG