from datetime import UTC, datetime

from ww_core.domain.project_repo import max_time


def test_max_time_handles_missing_values() -> None:
    now = datetime(2026, 6, 28, tzinfo=UTC)

    assert max_time(None, None) is None
    assert max_time(now, None) == now
    assert max_time(None, now) == now


def test_max_time_returns_latest_value() -> None:
    early = datetime(2026, 6, 27, tzinfo=UTC)
    late = datetime(2026, 6, 28, tzinfo=UTC)

    assert max_time(early, late) == late
    assert max_time(late, early) == late
