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

@@ -20,8 +20,8 @@ struct ScenarioPlannerFactoryTests {
let prefs = TripPreferences(
planningMode: .followTeam,
sports: [.mlb],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1,
@@ -41,8 +41,8 @@ struct ScenarioPlannerFactoryTests {
planningMode: .gameFirst,
sports: [.mlb],
mustSeeGameIds: [game.id],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1
@@ -64,8 +64,8 @@ struct ScenarioPlannerFactoryTests {
startLocation: LocationInput(name: "NYC", coordinate: nycCoord),
endLocation: LocationInput(name: "LA", coordinate: laCoord),
sports: [.mlb],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1
@@ -82,8 +82,8 @@ struct ScenarioPlannerFactoryTests {
let prefs = TripPreferences(
planningMode: .dateRange,
sports: [.mlb],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1
@@ -108,8 +108,8 @@ struct ScenarioPlannerFactoryTests {
endLocation: LocationInput(name: "LA", coordinate: laCoord), // C condition
sports: [.mlb],
mustSeeGameIds: [game.id], // B condition
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1,
@@ -135,8 +135,8 @@ struct ScenarioPlannerFactoryTests {
endLocation: LocationInput(name: "LA", coordinate: laCoord), // C condition
sports: [.mlb],
mustSeeGameIds: [game.id], // B condition
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1
@@ -156,8 +156,8 @@ struct ScenarioPlannerFactoryTests {
let prefs = TripPreferences(
planningMode: .followTeam,
sports: [.mlb],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1,
@@ -177,8 +177,8 @@ struct ScenarioPlannerFactoryTests {
planningMode: .gameFirst,
sports: [.mlb],
mustSeeGameIds: [game.id],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1
@@ -200,8 +200,8 @@ struct ScenarioPlannerFactoryTests {
startLocation: LocationInput(name: "NYC", coordinate: nycCoord),
endLocation: LocationInput(name: "LA", coordinate: laCoord),
sports: [.mlb],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1
@@ -218,8 +218,8 @@ struct ScenarioPlannerFactoryTests {
let prefs = TripPreferences(
planningMode: .dateRange,
sports: [.mlb],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1
@@ -239,8 +239,8 @@ struct ScenarioPlannerFactoryTests {
let prefsA = TripPreferences(
planningMode: .dateRange,
sports: [.mlb],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1
@@ -254,8 +254,8 @@ struct ScenarioPlannerFactoryTests {
let prefsD = TripPreferences(
planningMode: .followTeam,
sports: [.mlb],
startDate: Date(),
endDate: Date().addingTimeInterval(86400 * 7),
startDate: TestClock.now,
endDate: TestClock.now.addingTimeInterval(86400 * 7),
leisureLevel: .moderate,
lodgingType: .hotel,
numberOfDrivers: 1,
@@ -287,7 +287,7 @@ struct ScenarioPlannerFactoryTests {
homeTeamId: "team1",
awayTeamId: "team2",
stadiumId: "stadium1",
dateTime: Date(),
dateTime: TestClock.now,
sport: .mlb,
season: "2026",
isPlayoff: false