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:
@@ -38,6 +38,27 @@ import CoreLocation
|
||||
/// Scenario C: Directional route planning from start city to end city
|
||||
/// Input: start_location, end_location, day_span (or date_range)
|
||||
/// Output: Top 5 itinerary options with games along the directional route
|
||||
///
|
||||
/// - Expected Behavior:
|
||||
/// - No start location → returns .failure with .missingLocations
|
||||
/// - No end location → returns .failure with .missingLocations
|
||||
/// - Missing coordinates → returns .failure with .missingLocations
|
||||
/// - No stadiums in start city → returns .failure with .noGamesInRange
|
||||
/// - No stadiums in end city → returns .failure with .noGamesInRange
|
||||
/// - No valid date ranges → returns .failure with .missingDateRange
|
||||
/// - Directional filtering: only stadiums making forward progress included
|
||||
/// - Monotonic progress validation: route cannot backtrack significantly
|
||||
/// - Start and end locations added as non-game stops
|
||||
/// - No valid routes → .failure with .noValidRoutes
|
||||
/// - Success → returns sorted itineraries based on leisureLevel
|
||||
///
|
||||
/// - Invariants:
|
||||
/// - Start stop has no games and appears first
|
||||
/// - End stop has no games and appears last
|
||||
/// - All game stops are between start and end
|
||||
/// - Forward progress tolerance is 15%
|
||||
/// - Max detour distance is 1.5x direct distance
|
||||
///
|
||||
final class ScenarioCPlanner: ScenarioPlanner {
|
||||
|
||||
// MARK: - Configuration
|
||||
|
||||
Reference in New Issue
Block a user