Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion backend/tests/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,19 @@ def test_statistics_invalid_timezone_falls_back_to_utc(client: Any, session: Ses

resp = client.get("/api/statistics")
assert resp.status_code == 200
assert resp.json()["books_finished_per_month"] == [{"month": "2026-05", "count": 1}]
data = resp.json()
now = datetime.now(timezone.utc)
expected_months = []
year, month = 2026, 5
while (year < now.year) or (year == now.year and month <= now.month):
expected_months.append(f"{year:04d}-{month:02d}")
month += 1
if month > 12:
month = 1
year += 1
assert data["books_finished_per_month"] == [
{"month": m, "count": 1 if m == "2026-05" else 0} for m in expected_months
]


def test_pages_per_day_fallback_books_without_progress(client: Any) -> None:
Expand Down