""" Smoke tests for date_resolver module. """ from datetime import date from dateutil.relativedelta import relativedelta import sys sys.path.insert(0, '..') from date_resolver import resolve_dates, detect_new_connections, SEARCH_WINDOW_MONTHS def test_resolve_dates_with_specific_date(): """Test that a specific date returns only that date.""" result = resolve_dates("2026-06-15", 6) assert result == ["2026-06-15"] print("āœ“ Specific date resolution works") def test_resolve_dates_seasonal(): """Test that seasonal mode generates one date per month.""" result = resolve_dates(None, 3) assert len(result) == 3 # All should be valid date strings for date_str in result: assert len(date_str) == 10 # YYYY-MM-DD format assert date_str.count('-') == 2 print(f"āœ“ Seasonal resolution works: {result}") def test_detect_new_connections(): """Test new connection detection logic.""" monthly_results = { "2026-03": [ {"origin": "FRA", "destination": "JFK"}, {"origin": "MUC", "destination": "JFK"}, ], "2026-04": [ {"origin": "FRA", "destination": "JFK"}, {"origin": "MUC", "destination": "JFK"}, {"origin": "BER", "destination": "JFK"}, # NEW ], "2026-05": [ {"origin": "FRA", "destination": "JFK"}, {"origin": "BER", "destination": "JFK"}, {"origin": "HAM", "destination": "JFK"}, # NEW ], } new = detect_new_connections(monthly_results) assert "BER->JFK" in new assert new["BER->JFK"] == "2026-04" assert "HAM->JFK" in new assert new["HAM->JFK"] == "2026-05" assert "FRA->JFK" not in new # Was in first month assert "MUC->JFK" not in new # Was in first month print(f"āœ“ New connection detection works: {new}") if __name__ == "__main__": test_resolve_dates_with_specific_date() test_resolve_dates_seasonal() test_detect_new_connections() print("\nāœ… All date_resolver tests passed!")