"""Display time helpers use Asia/Shanghai for operators."""

from datetime import datetime, timezone

from server.utils.display_time import format_beijing, to_beijing


def test_format_beijing_from_utc():
    dt = datetime(2026, 6, 8, 4, 30, 0, tzinfo=timezone.utc)
    assert format_beijing(dt, with_label=False) == "2026-06-08 12:30:00"
    assert format_beijing(dt).endswith("北京时间")


def test_to_beijing_naive_as_utc():
    naive = datetime(2026, 6, 8, 4, 30, 0)
    bj = to_beijing(naive)
    assert bj.hour == 12
    assert bj.minute == 30
