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:
@@ -64,23 +64,23 @@ struct POITests {
|
||||
#expect(justOverPOI.formattedDistance.contains("mi"))
|
||||
}
|
||||
|
||||
/// - Expected Behavior: Zero distance formats correctly
|
||||
/// - Expected Behavior: Zero distance formats as "0 ft"
|
||||
@Test("formattedDistance: handles zero distance")
|
||||
func formattedDistance_zero() {
|
||||
// 0 meters = 0 feet, and 0 miles < 0.1 so it uses feet format
|
||||
// String(format: "%.0f ft", 0 * 3.28084) == "0 ft"
|
||||
let poi = makePOI(distanceMeters: 0)
|
||||
let formatted = poi.formattedDistance
|
||||
#expect(formatted.contains("0") || formatted.contains("ft"))
|
||||
#expect(formatted == "0 ft", "Zero distance should format as '0 ft', got '\(formatted)'")
|
||||
}
|
||||
|
||||
/// - Expected Behavior: Large distance formats correctly
|
||||
/// - Expected Behavior: Large distance formats correctly as miles
|
||||
@Test("formattedDistance: handles large distance")
|
||||
func formattedDistance_large() {
|
||||
// 5000 meters = ~3.1 miles
|
||||
// 5000 meters * 0.000621371 = 3.106855 miles → "3.1 mi"
|
||||
let poi = makePOI(distanceMeters: 5000)
|
||||
let formatted = poi.formattedDistance
|
||||
|
||||
#expect(formatted.contains("mi"))
|
||||
#expect(formatted.contains("3.1") || formatted.contains("3.") || Double(formatted.replacingOccurrences(of: " mi", with: ""))! > 3.0)
|
||||
#expect(formatted == "3.1 mi", "5000m should format as '3.1 mi', got '\(formatted)'")
|
||||
}
|
||||
|
||||
// MARK: - Invariant Tests
|
||||
|
||||
Reference in New Issue
Block a user