""" Phase G — Sync History Tests Tests for GET /history: rendering _sync_log.md as a reverse-chronological table. """ import textwrap from pathlib import Path import pytest pytestmark = pytest.mark.asyncio # --------------------------------------------------------------------------- # Helpers # --------------------------------------------------------------------------- SAMPLE_LOG = textwrap.dedent("""\ # Sync Log | Timestamp | Direction | Files | Status | |-----------|-----------|-------|--------| | 2026-03-03 22:15 | push | 1 updated | error: CV.md failed | | 2026-03-04 08:00 | pull | 0 changes | ok | | 2026-03-05 09:10 | push | 2 updated, 1 created | ok | | 2026-03-06 14:32 | pull | 3 updated | ok | """) MINIMAL_LOG = textwrap.dedent("""\ # Sync Log | Timestamp | Direction | Files | Status | |-----------|-----------|-------|--------| | 2026-01-01 00:00 | pull | 1 updated | ok | """) # --------------------------------------------------------------------------- # US-G1 — History page renders # --------------------------------------------------------------------------- class TestHistoryPage: async def test_history_returns_200(self, client): r = await client.get("/history") assert r.status_code == 200 async def test_history_returns_html(self, client): r = await client.get("/history") assert "text/html" in r.headers.get("content-type", "") async def test_history_page_contains_table(self, client, vault_dir, sync_log): r = await client.get("/history") body = r.text.lower() assert "