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:
Trey T
2026-04-04 23:00:46 -05:00
parent 9b622f8bbb
commit a6f538dfed
23 changed files with 265 additions and 109 deletions

View File

@@ -97,8 +97,9 @@ struct TripStopTests {
@Test("formattedDateRange: single date for 1-day stay")
func formattedDateRange_singleDay() {
let calendar = TestClock.calendar
let date = calendar.date(from: DateComponents(year: 2026, month: 6, day: 15))!
// formattedDateRange uses DateFormatter with system timezone, so create dates
// at noon to ensure the calendar day is stable across US timezones.
let date = TestFixtures.date(year: 2026, month: 6, day: 15, hour: 12)
let stop = makeStop(arrivalDate: date, departureDate: date)
@@ -108,9 +109,10 @@ struct TripStopTests {
@Test("formattedDateRange: range for multi-day stay")
func formattedDateRange_multiDay() {
let calendar = TestClock.calendar
let arrival = calendar.date(from: DateComponents(year: 2026, month: 6, day: 15))!
let departure = calendar.date(from: DateComponents(year: 2026, month: 6, day: 18))!
// formattedDateRange uses DateFormatter with system timezone, so create dates
// at noon to ensure the calendar day is stable across US timezones.
let arrival = TestFixtures.date(year: 2026, month: 6, day: 15, hour: 12)
let departure = TestFixtures.date(year: 2026, month: 6, day: 18, hour: 12)
let stop = makeStop(arrivalDate: arrival, departureDate: departure)