Full rename ahead of App Store submission: project, targets, bundle identifiers (dev.bchen.Severed -> dev.bchen.OpenAppLock), entitlements file, app entry point, user-facing onboarding strings, test helpers, and docs. Verified: all 62 unit tests pass.
37 lines
1.1 KiB
Swift
37 lines
1.1 KiB
Swift
//
|
||
// TestSupport.swift
|
||
// OpenAppLockTests
|
||
//
|
||
|
||
import Foundation
|
||
|
||
@testable import OpenAppLock
|
||
|
||
/// Fixed UTC gregorian calendar so schedule math is deterministic regardless
|
||
/// of the machine running the tests.
|
||
let utc: Calendar = {
|
||
var calendar = Calendar(identifier: .gregorian)
|
||
calendar.timeZone = TimeZone(identifier: "UTC")!
|
||
return calendar
|
||
}()
|
||
|
||
/// Builds a date in the UTC test calendar. 2025-01-06 is a Monday; the tests
|
||
/// use that week (Jan 6–12, 2025) as their anchor.
|
||
func date(
|
||
_ year: Int, _ month: Int, _ day: Int, _ hour: Int = 0, _ minute: Int = 0
|
||
) -> Date {
|
||
utc.date(
|
||
from: DateComponents(year: year, month: month, day: day, hour: hour, minute: minute)
|
||
)!
|
||
}
|
||
|
||
/// Monday of the anchor week.
|
||
enum AnchorWeek {
|
||
static let monday = (year: 2025, month: 1, day: 6)
|
||
static let tuesday = (year: 2025, month: 1, day: 7)
|
||
static let wednesday = (year: 2025, month: 1, day: 8)
|
||
static let saturday = (year: 2025, month: 1, day: 11)
|
||
static let sunday = (year: 2025, month: 1, day: 12)
|
||
static let nextMonday = (year: 2025, month: 1, day: 13)
|
||
}
|