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

@@ -24,7 +24,7 @@ struct ScenarioDPlannerTests {
@Test("plan: no followTeamId returns missingTeamSelection failure")
func plan_noFollowTeamId_returnsMissingTeamSelection() {
let startDate = Date()
let startDate = TestClock.now
let endDate = startDate.addingTimeInterval(86400 * 7)
let prefs = TripPreferences(
@@ -58,7 +58,7 @@ struct ScenarioDPlannerTests {
@Test("plan: no games for team returns noGamesInRange failure")
func plan_noGamesForTeam_returnsNoGamesInRange() {
let startDate = Date()
let startDate = TestClock.now
let endDate = startDate.addingTimeInterval(86400 * 7)
let stadium = makeStadium(id: "stadium1", city: "New York", coordinate: nycCoord)
@@ -105,7 +105,7 @@ struct ScenarioDPlannerTests {
@Test("plan: includes both home and away games for team")
func plan_includesBothHomeAndAwayGames() {
let startDate = Date()
let startDate = TestClock.now
let endDate = startDate.addingTimeInterval(86400 * 14)
let nycStadium = makeStadium(id: "nyc", city: "New York", coordinate: nycCoord)
@@ -168,7 +168,7 @@ struct ScenarioDPlannerTests {
@Test("plan: with selectedRegions filters team games to those regions")
func plan_withSelectedRegions_filtersTeamGames() {
let startDate = Date()
let startDate = TestClock.now
let endDate = startDate.addingTimeInterval(86400 * 14)
let nycStadium = makeStadium(id: "nyc", city: "New York", coordinate: nycCoord) // East
@@ -229,7 +229,7 @@ struct ScenarioDPlannerTests {
@Test("plan: valid request returns success")
func plan_validRequest_returnsSuccess() {
let startDate = Date()
let startDate = TestClock.now
let endDate = startDate.addingTimeInterval(86400 * 7)
let stadium = makeStadium(id: "stadium1", city: "New York", coordinate: nycCoord)
@@ -274,7 +274,7 @@ struct ScenarioDPlannerTests {
@Test("plan: useHomeLocation with startLocation adds home start and end stops")
func plan_useHomeLocationWithStartLocation_addsHomeEndpoints() {
let startDate = Date()
let startDate = TestClock.now
let endDate = startDate.addingTimeInterval(86400 * 10)
let homeCoord = CLLocationCoordinate2D(latitude: 39.7392, longitude: -104.9903) // Denver
@@ -333,7 +333,7 @@ struct ScenarioDPlannerTests {
@Test("Invariant: all returned games have team as home or away")
func invariant_allGamesHaveTeam() {
let startDate = Date()
let startDate = TestClock.now
let endDate = startDate.addingTimeInterval(86400 * 14)
let nycStadium = makeStadium(id: "nyc", city: "New York", coordinate: nycCoord)
@@ -404,7 +404,7 @@ struct ScenarioDPlannerTests {
@Test("Invariant: duplicate routes are removed")
func invariant_duplicateRoutesRemoved() {
let startDate = Date()
let startDate = TestClock.now
let endDate = startDate.addingTimeInterval(86400 * 7)
let stadium = makeStadium(id: "stadium1", city: "New York", coordinate: nycCoord)
@@ -454,7 +454,7 @@ struct ScenarioDPlannerTests {
@Test("Property: success always has non-empty options")
func property_successHasNonEmptyOptions() {
let startDate = Date()
let startDate = TestClock.now
let endDate = startDate.addingTimeInterval(86400 * 7)
let stadium = makeStadium(id: "stadium1", city: "New York", coordinate: nycCoord)