aboutsummaryrefslogtreecommitdiff
path: root/.ai/scripts/tests/test_drill_deck_diff_ids.py
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-30 13:27:29 -0500
committerCraig Jennings <c@cjennings.net>2026-05-30 13:27:29 -0500
commita6313954fc297ee4a6c1c42ba903730a364cd5df (patch)
treef55cc085d966684253c6e7daaeee27593ca08801 /.ai/scripts/tests/test_drill_deck_diff_ids.py
parent0234e52b727b34ade93961eb05b5638685f4406f (diff)
downloadrulesets-a6313954fc297ee4a6c1c42ba903730a364cd5df.tar.gz
rulesets-a6313954fc297ee4a6c1c42ba903730a364cd5df.zip
test(scripts): cover drill-to-anki internals, broadcast, and daily-prep
I backfilled the gaps left after the flashcard work landed. drill-to-anki.py had tests only for its two default helpers. I added coverage for the core parser and its pieces: parse (section-to-tag mapping, drawer-only body, blank trimming, multiline join, no-card input), strip_org_metadata (drawer and planning-line stripping, unclosed drawer), section_to_tag, escape_html, and the deterministic stable_id. I also filled the remaining drill-deck-stats / drill-deck-diff-ids branches (missing-title and PROPERTIES-mismatch warnings, the appeared-IDs note path). I added test_cross_project_broadcast.py for the two scripts that had none here: is_broadcastable / discover (SEARCH_ROOTS pointed at a tmp tree) / sender_project / inbox_send_path, plus an ERT suite for daily-prep-agenda.el (dp-iso-date, dp-bucket with the clock pinned, dp-format-entry, and dp-collect end to end on a temp org file). daily-prep-agenda.el needed one change to be loadable under ERT: its batch entrypoint fired on any load. I gated it behind dp--cli-invocation-p, the same readable-files check lint-org.el already uses, so requiring the file for tests no longer runs the extractor. A real invocation with a file argument still fires. A no-argument run now no-ops instead of printing an empty header.
Diffstat (limited to '.ai/scripts/tests/test_drill_deck_diff_ids.py')
-rw-r--r--.ai/scripts/tests/test_drill_deck_diff_ids.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/.ai/scripts/tests/test_drill_deck_diff_ids.py b/.ai/scripts/tests/test_drill_deck_diff_ids.py
index 9cd8305..15fb148 100644
--- a/.ai/scripts/tests/test_drill_deck_diff_ids.py
+++ b/.ai/scripts/tests/test_drill_deck_diff_ids.py
@@ -86,3 +86,24 @@ def test_cli_dropped_id_warns_and_exits_one(tmp_path):
assert r.returncode == 1
assert "disappeared" in r.stdout.lower()
assert "id-2" in r.stdout
+
+
+DECK_ONE = """* Section
+** What is DeepSat? :drill:
+:PROPERTIES:
+:ID: id-1
+:END:
+Body.
+"""
+
+
+def test_cli_appeared_only_notes_new_ids_and_exits_one(tmp_path):
+ # before has id-1; after adds id-2 and drops nothing.
+ before = tmp_path / "before.org"
+ before.write_text(DECK_ONE)
+ after = tmp_path / "after.org"
+ after.write_text(DECK_A)
+ r = _run(before, after)
+ assert r.returncode == 1
+ assert "appeared" in r.stdout.lower()
+ assert "id-2" in r.stdout