refactor(tests): TDD rewrite of all unit tests with spec documentation
Complete rewrite of unit test suite using TDD methodology: Planning Engine Tests: - GameDAGRouterTests: Beam search, anchor games, transitions - ItineraryBuilderTests: Stop connection, validators, EV enrichment - RouteFiltersTests: Region, time window, scoring filters - ScenarioA/B/C/D PlannerTests: All planning scenarios - TravelEstimatorTests: Distance, duration, travel days - TripPlanningEngineTests: Orchestration, caching, preferences Domain Model Tests: - AchievementDefinitionsTests, AnySportTests, DivisionTests - GameTests, ProgressTests, RegionTests, StadiumTests - TeamTests, TravelSegmentTests, TripTests, TripPollTests - TripPreferencesTests, TripStopTests, SportTests Service Tests: - FreeScoreAPITests, RouteDescriptionGeneratorTests - SuggestedTripsGeneratorTests Export Tests: - ShareableContentTests (card types, themes, dimensions) Bug fixes discovered through TDD: - ShareCardDimensions: mapSnapshotSize exceeded available width (960x480) - ScenarioBPlanner: Added anchor game validation filter All tests include: - Specification tests (expected behavior) - Invariant tests (properties that must always hold) - Edge case tests (boundary conditions) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,22 @@ import CoreLocation
|
||||
/// We find: Lakers (Jan 5), Warriors (Jan 7), Kings (Jan 9)
|
||||
/// Output: Single itinerary visiting LA → SF → Sacramento in order
|
||||
///
|
||||
/// - Expected Behavior:
|
||||
/// - No date range → returns .failure with .missingDateRange
|
||||
/// - No games in date range → returns .failure with .noGamesInRange
|
||||
/// - With selectedRegions → only includes games in those regions
|
||||
/// - With mustStopLocation → filters to home games in that city
|
||||
/// - Empty games after must-stop filter → .failure with .noGamesInRange
|
||||
/// - No valid routes from GameDAGRouter → .failure with .noValidRoutes
|
||||
/// - All routes fail ItineraryBuilder → .failure with .constraintsUnsatisfiable
|
||||
/// - Success → returns sorted itineraries based on leisureLevel
|
||||
///
|
||||
/// - Invariants:
|
||||
/// - Returned games are always within the date range
|
||||
/// - Returned games are always chronologically ordered within each stop
|
||||
/// - buildStops groups consecutive games at the same stadium
|
||||
/// - Visiting A→B→A creates 3 separate stops (not 2)
|
||||
///
|
||||
final class ScenarioAPlanner: ScenarioPlanner {
|
||||
|
||||
// MARK: - ScenarioPlanner Protocol
|
||||
|
||||
Reference in New Issue
Block a user