summaryrefslogtreecommitdiff
path: root/todo.org
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-16 01:34:03 -0500
committerCraig Jennings <c@cjennings.net>2026-05-16 01:34:03 -0500
commit2a98feaf1285b495e7d6d1eed2abf02620188e29 (patch)
tree472415397aa9e5d6e0364c4d9a28ffbc9948bea7 /todo.org
parent1ca46c2b477afd014ef993ed0ca5ca50e257adce (diff)
downloaddotemacs-2a98feaf1285b495e7d6d1eed2abf02620188e29.tar.gz
dotemacs-2a98feaf1285b495e7d6d1eed2abf02620188e29.zip
test(ai-conversations): add 36 ERT tests covering helpers and entry points
ai-conversations.el shipped without direct tests. This file covers every helper and interactive entry point across Normal / Boundary / Error. Helpers: `cj/gptel--slugify-topic` (ASCII, empty input, all-special, unicode stripped, idempotent, trim, digits); `cj/gptel--timestamp- from-filename` (normal decode, year-edge boundaries, malformed inputs returning nil); `cj/gptel--existing-topics` and `cj/gptel-- latest-file-for-topic` (multi-topic / multi-timestamp temp dirs, empty dir, missing dir, prefix-overlap isolation); `cj/gptel-- conversation-candidates` (newest-first and oldest-first sort order, display-string shape, error on missing dir); `cj/gptel--save-buffer- to-file` (visibility headers prepended, round-trip through `cj/ gptel--strip-visibility-headers`). Autosave: post-response hook saves only when gptel-mode + enabled + filepath are all set; autosave-after-send swallows write errors via `message` instead of signaling; the install-once guard prevents double-registration. Interactive entry points: save/delete exercised via `cl-letf` stubs on `completing-read` and `y-or-n-p`. Per-test temp directories; no writes outside them.
Diffstat (limited to 'todo.org')
-rw-r--r--todo.org23
1 files changed, 11 insertions, 12 deletions
diff --git a/todo.org b/todo.org
index d9d3635d..8313d8bc 100644
--- a/todo.org
+++ b/todo.org
@@ -2625,18 +2625,17 @@ guard against the regression is "no entry for =magit=, entries for
=git-commit=, =magit-commit=, =magit-diff=," which is exactly what
the test asserts.
-*** TODO [#B] Add ERT coverage for ai-conversations.el :tests:
-
-Currently zero direct tests on the 274-line module. Cover at least:
-- =cj/gptel--slugify-topic= — Normal / Boundary (empty, all-special-chars, unicode, idempotent slug) / Error.
-- =cj/gptel--timestamp-from-filename= — Normal / Boundary (year/month/day/hour/min/sec edges) / Error (malformed filename → nil).
-- =cj/gptel--existing-topics= and =cj/gptel--latest-file-for-topic= — with a temp conversations directory containing multiple topics + multiple timestamps each.
-- =cj/gptel--conversation-candidates= — sort order honored for both =newest-first= and =oldest-first=.
-- =cj/gptel--save-buffer-to-file= — visibility headers prepended; round-trips back through =cj/gptel--strip-visibility-headers=.
-- The =with-eval-after-load 'gptel= advice/hook installs once and isn't duplicated on re-load.
-- Interactive entry points (=save= / =load= / =delete=) exercised via =cl-letf= stubs on =completing-read= and =y-or-n-p=.
-
-Use a per-test temp conversations directory; no writes outside it. Target ≥80% coverage on the module.
+*** 2026-05-16 Sat @ 01:33:20 -0500 Added ERT coverage for ai-conversations.el
+
+=tests/test-ai-conversations.el= covers every helper in the module
+plus the interactive entry points. 36 tests across Normal / Boundary /
+Error categories: slug normalization, timestamp decoding, file
+enumeration (existing topics, latest-for-topic, candidate ordering for
+both =newest-first= and =oldest-first=), the save-buffer/strip-headers
+round-trip, the autosave-after-send + autosave-after-response hooks,
+the install-once guard for the post-response hook, and the
+save/delete interactive entry points exercised via =cl-letf= stubs.
+Per-test temp directories; no writes outside them.
*** TODO [#B] Add ERT coverage for gptel-tools .el files :tests: