From a7cb3bc6760aa9467b9b2455275f51aa522b1434 Mon Sep 17 00:00:00 2001 From: nikrich Date: Mon, 18 May 2026 11:49:27 +0200 Subject: [PATCH] test: refresh two stale expectations against current production behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - test_macos_connector_normalizes_jxa_payload: also patch _fetch_via_eventkit to return None. The connector now tries EventKit before JXA, so on dev machines with calendar access granted the subprocess.run mock was bypassed and real events leaked in. - test_render_emits_wikilinks_for_artifacts: assert the humanized alias (|Defer simi]]) introduced by the slug-humanizer feature. Path slug is still validated separately. No production code changes — both tests were drifting from existing behavior. Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/test_calendar.py | 7 ++++++- tests/test_weekly_digest.py | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/test_calendar.py b/tests/test_calendar.py index 6f6b351..3f9647f 100644 --- a/tests/test_calendar.py +++ b/tests/test_calendar.py @@ -223,7 +223,12 @@ class FakeProc: stdout = json.dumps(fake_payload) stderr = "" - with patch("ghostbrain.connectors.calendar.macos.subprocess.run", + # Force the JXA fallback path: on dev machines with EventKit access + # granted, `_fetch_via_eventkit` would return real calendar data and + # bypass the subprocess mock entirely. + with patch("ghostbrain.connectors.calendar.macos._fetch_via_eventkit", + return_value=None), \ + patch("ghostbrain.connectors.calendar.macos.subprocess.run", return_value=FakeProc()): events = connector.fetch(datetime(2026, 5, 9, tzinfo=timezone.utc)) diff --git a/tests/test_weekly_digest.py b/tests/test_weekly_digest.py index 0e3d456..0a002ab 100644 --- a/tests/test_weekly_digest.py +++ b/tests/test_weekly_digest.py @@ -226,9 +226,11 @@ def test_render_emits_wikilinks_for_artifacts(vault: Path) -> None: inp = build_weekly_input(week_end) rendered = render_weekly_input_for_prompt(inp) - # Wikilink form should be aliased: [[path|alias]] - assert "[[20-contexts/sanlam/calendar/artifacts/decisions/" in rendered - assert "|defer-simi]]" in rendered or "defer-simi]" in rendered + # Wikilink form should be aliased: [[path|alias]]. The alias is the + # humanized form of the slug (see _humanize_slug in worker/digest.py), + # so "defer-simi" → "Defer simi". + assert "[[20-contexts/sanlam/calendar/artifacts/decisions/defer-simi|" in rendered + assert "|Defer simi]]" in rendered # Type grouping should appear assert "decisions (1):" in rendered assert "action_items (1):" in rendered