"""Tests para format_simplified."""

import sys
import os

sys.path.insert(0, os.path.dirname(__file__))

from datetime import datetime, timedelta
from format_simplified import format_simplified


def test_mismo_dia_muestra_formato_hora():
    now = datetime(2026, 2, 21, 15, 0, 0)
    dt = datetime(2026, 2, 21, 9, 30, 45)
    result = format_simplified(dt, now)
    assert result == "09:30:45"


def test_dia_anterior_muestra_formato_fecha():
    now = datetime(2026, 2, 21, 15, 0, 0)
    dt = datetime(2026, 2, 20, 9, 30, 45)
    result = format_simplified(dt, now)
    assert result == "2026-02-20"


def test_exactamente_24h_muestra_formato_fecha():
    now = datetime(2026, 2, 21, 15, 0, 0)
    dt = now - timedelta(hours=24)
    result = format_simplified(dt, now)
    assert result == "2026-02-20"
