This commit is contained in:
Michael Freno
2026-01-27 14:12:24 -05:00
parent fda136f3d4
commit f8868c9253
31 changed files with 2030 additions and 1790 deletions

View File

@@ -0,0 +1,33 @@
//
// MockTimeProvider.swift
// GazeTests
//
// Mock time provider for deterministic timer testing.
//
import Foundation
@testable import Gaze
/// A mock time provider for deterministic testing.
/// Allows manual control over time in tests.
final class MockTimeProvider: TimeProviding, @unchecked Sendable {
private var currentTime: Date
init(startTime: Date = Date()) {
self.currentTime = startTime
}
func now() -> Date {
currentTime
}
/// Advances time by the specified interval
func advance(by interval: TimeInterval) {
currentTime = currentTime.addingTimeInterval(interval)
}
/// Sets the current time to a specific date
func setTime(_ date: Date) {
currentTime = date
}
}