diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-23 20:12:58 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-23 20:12:58 -0400 |
| commit | 10fa6f4e2e7150ad99827721ada1ae4badcc5e90 (patch) | |
| tree | 960065c8e69f1e7a4150ecf522e2f813c239b5ee /archive/gptel/tests/test-ai-config-backend-and-model.el | |
| parent | f4cc70c69e7707dd4a686637e14885f5443fcca6 (diff) | |
| download | dotemacs-10fa6f4e2e7150ad99827721ada1ae4badcc5e90.tar.gz dotemacs-10fa6f4e2e7150ad99827721ada1ae4badcc5e90.zip | |
chore(ai): archive gptel and remove it from the live config
I archived gptel to archive/gptel/ since I rarely use it. Moved there: the six gptel modules (ai-config, ai-conversations, ai-conversations-browser, ai-mcp, ai-quick-ask, ai-rewrite), the gptel-tools/ directory, custom/gptel-prompts.el, their test files and utilities, and the four gptel-only specs.
Scrubbed from the live config: the ai-config require in init.el, which also drops the whole C-; a keymap; the gptel-mode emojify hook in font-config.el; the gptel-tools entries in the Makefile clean target and the coverage runner; and the gptel feature notes in README. Cancelled the open gptel tasks in todo.org (the AI Open Work issues, the feature-extension brainstorm, the velox gptel-magit bug).
ai-term stays. It is the ghostel Claude launcher, independent of gptel.
Verified: every module loads, a batch init launch reaches completion clean, and the full test suite shows only pre-existing coverage failures unrelated to this change.
Diffstat (limited to 'archive/gptel/tests/test-ai-config-backend-and-model.el')
| -rw-r--r-- | archive/gptel/tests/test-ai-config-backend-and-model.el | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/archive/gptel/tests/test-ai-config-backend-and-model.el b/archive/gptel/tests/test-ai-config-backend-and-model.el new file mode 100644 index 00000000..c03c58a2 --- /dev/null +++ b/archive/gptel/tests/test-ai-config-backend-and-model.el @@ -0,0 +1,78 @@ +;;; test-ai-config-backend-and-model.el --- Tests for cj/gptel-backend-and-model -*- lexical-binding: t; -*- + +;;; Commentary: +;; Tests for cj/gptel-backend-and-model from ai-config.el. +;; +;; Returns a formatted string "backend: model [timestamp]" for use in +;; org headings marking AI responses. Uses pcase to extract the display +;; name from vector backends, falling back to "AI" otherwise. + +;;; Code: + +(require 'ert) + +(add-to-list 'load-path (expand-file-name "tests" user-emacs-directory)) +(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) +(require 'testutil-ai-config) +(require 'ai-config) + +;;; Normal Cases + +(ert-deftest test-ai-config-backend-and-model-normal-vector-backend-extracts-name () + "Vector backend should use element at index 1 as display name." + (let ((gptel-backend (vector 'cl-struct "Claude")) + (gptel-model "claude-opus-4-6")) + (let ((result (cj/gptel-backend-and-model))) + (should (string-match-p "^Claude:" result)) + (should (string-match-p "claude-opus-4-6" result))))) + +(ert-deftest test-ai-config-backend-and-model-normal-contains-timestamp () + "Result should contain a bracketed timestamp." + (let ((gptel-backend nil) + (gptel-model nil)) + (should (string-match-p "\\[[-0-9]+ [0-9]+:[0-9]+:[0-9]+\\]" + (cj/gptel-backend-and-model))))) + +(ert-deftest test-ai-config-backend-and-model-normal-format-structure () + "Result should follow 'backend: model [timestamp]' format." + (let ((gptel-backend (vector 'cl-struct "TestBackend")) + (gptel-model "test-model")) + (should (string-match-p "^TestBackend: test-model \\[" + (cj/gptel-backend-and-model))))) + +;;; Boundary Cases + +(ert-deftest test-ai-config-backend-and-model-boundary-nil-backend-shows-ai () + "Nil backend should fall back to \"AI\" display name." + (let ((gptel-backend nil) + (gptel-model "some-model")) + (should (string-match-p "^AI:" (cj/gptel-backend-and-model))))) + +(ert-deftest test-ai-config-backend-and-model-boundary-nil-model-shows-empty () + "Nil model should produce empty string in model position." + (let ((gptel-backend nil) + (gptel-model nil)) + (should (string-match-p "^AI: \\[" (cj/gptel-backend-and-model))))) + +(ert-deftest test-ai-config-backend-and-model-boundary-string-backend-shows-ai () + "String backend (not vector) should fall back to \"AI\"." + (let ((gptel-backend "just-a-string") + (gptel-model "model")) + (should (string-match-p "^AI:" (cj/gptel-backend-and-model))))) + +(ert-deftest test-ai-config-backend-and-model-boundary-symbol-model-formatted () + "Symbol model should be formatted as its print representation." + (let ((gptel-backend nil) + (gptel-model 'some-model)) + (should (string-match-p "some-model" (cj/gptel-backend-and-model))))) + +(ert-deftest test-ai-config-backend-and-model-boundary-timestamp-reflects-today () + "Timestamp should contain today's date." + (let ((gptel-backend nil) + (gptel-model nil) + (today (format-time-string "%Y-%m-%d"))) + (should (string-match-p (regexp-quote today) + (cj/gptel-backend-and-model))))) + +(provide 'test-ai-config-backend-and-model) +;;; test-ai-config-backend-and-model.el ends here |
