Audit and fix 52 test correctness issues across 22 files
Systematic audit of 1,191 tests found tests written to pass rather than verify correctness. Key fixes: Infrastructure: - TestClock: fixed timezone from .current to America/New_York (deterministic) - TestFixtures: added 1.3x road routing factor to match production - ItineraryTestHelpers: real per-city coordinates instead of hardcoded (40,-80) Planning tests: - Added missing Scenario E factory dispatch tests - Tightened 12 loose assertions (>= 1 → == 8.0, > 0 → range checks) - Fixed 4 no-op tests that accepted both success and failure - Fixed wrong repeat-city invariant (was checking same-day, not different-day) - Fixed tautological assertion in missing-stadium edge case Services/Domain/Export tests: - Replaced 4 placeholder tests (#expect(true)) with real assertions - Fixed tautological assertions in POISearchServiceTests - Fixed Chicago coordinate in RegionMapSelectorTests (-89 → -87.6553) - Added sort order verification to ItineraryRowFlatteningTests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -685,15 +685,16 @@ struct ScenarioEPlannerTests {
|
||||
|
||||
let result = planner.plan(request: request)
|
||||
|
||||
// Should fail because driving constraint cannot be met
|
||||
// Should fail because driving constraint cannot be met (NYC→LA is ~40h, single driver max 8h/day)
|
||||
guard case .failure(let failure) = result else {
|
||||
Issue.record("Expected failure when driving constraint cannot be met")
|
||||
Issue.record("Expected failure when driving constraint cannot be met (NYC→LA with 1 driver, 8h max)")
|
||||
return
|
||||
}
|
||||
|
||||
// Could be noValidRoutes or constraintsUnsatisfiable
|
||||
let validFailures: [PlanningFailure.FailureReason] = [.noValidRoutes, .constraintsUnsatisfiable]
|
||||
#expect(validFailures.contains { $0 == failure.reason }, "Should fail due to route constraints")
|
||||
// Verify the failure is specifically about driving/route constraints, not a generic error
|
||||
let validFailures: [PlanningFailure.FailureReason] = [.noValidRoutes, .constraintsUnsatisfiable, .drivingExceedsLimit]
|
||||
#expect(validFailures.contains { $0 == failure.reason },
|
||||
"Expected driving-related failure (.noValidRoutes, .constraintsUnsatisfiable, or .drivingExceedsLimit), got \(failure.reason)")
|
||||
}
|
||||
|
||||
// MARK: - E4. Edge Case Tests
|
||||
|
||||
Reference in New Issue
Block a user