aboutsummaryrefslogtreecommitdiff
path: root/tests/test-ai-config-build-model-list.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-23 20:12:58 -0400
committerCraig Jennings <c@cjennings.net>2026-06-23 20:12:58 -0400
commit10fa6f4e2e7150ad99827721ada1ae4badcc5e90 (patch)
tree960065c8e69f1e7a4150ecf522e2f813c239b5ee /tests/test-ai-config-build-model-list.el
parentf4cc70c69e7707dd4a686637e14885f5443fcca6 (diff)
downloaddotemacs-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 'tests/test-ai-config-build-model-list.el')
-rw-r--r--tests/test-ai-config-build-model-list.el101
1 files changed, 0 insertions, 101 deletions
diff --git a/tests/test-ai-config-build-model-list.el b/tests/test-ai-config-build-model-list.el
deleted file mode 100644
index 82703603..00000000
--- a/tests/test-ai-config-build-model-list.el
+++ /dev/null
@@ -1,101 +0,0 @@
-;;; test-ai-config-build-model-list.el --- Tests for cj/gptel--build-model-list -*- lexical-binding: t; -*-
-
-;;; Commentary:
-;; Tests for cj/gptel--build-model-list from ai-config.el.
-;;
-;; Pure function that takes a backends alist and a model-fetching function,
-;; and produces a flat list of (DISPLAY-STRING BACKEND MODEL-STRING BACKEND-NAME)
-;; entries suitable for completing-read. Exercises the mapping and string
-;; formatting logic that was previously embedded in cj/gptel-change-model.
-
-;;; 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-build-model-list-normal-single-backend-single-model ()
- "One backend with one model should produce one entry."
- (let* ((backend-obj 'fake-backend)
- (backends `(("Claude" . ,backend-obj)))
- (result (cj/gptel--build-model-list backends (lambda (_) '("opus")))))
- (should (= 1 (length result)))
- (should (equal (car (nth 0 result)) "Claude: opus"))
- (should (eq (nth 1 (nth 0 result)) backend-obj))
- (should (equal (nth 2 (nth 0 result)) "opus"))
- (should (equal (nth 3 (nth 0 result)) "Claude"))))
-
-(ert-deftest test-ai-config-build-model-list-normal-single-backend-multiple-models ()
- "One backend with multiple models should produce one entry per model."
- (let* ((backends '(("Claude" . backend-a)))
- (result (cj/gptel--build-model-list
- backends (lambda (_) '("opus" "sonnet" "haiku")))))
- (should (= 3 (length result)))
- (should (equal (mapcar #'car result)
- '("Claude: opus" "Claude: sonnet" "Claude: haiku")))))
-
-(ert-deftest test-ai-config-build-model-list-normal-multiple-backends ()
- "Multiple backends should interleave their models in backend order."
- (let* ((backends '(("Claude" . backend-a) ("OpenAI" . backend-b)))
- (result (cj/gptel--build-model-list
- backends
- (lambda (b)
- (if (eq b 'backend-a) '("opus") '("gpt-4o"))))))
- (should (= 2 (length result)))
- (should (equal (car (nth 0 result)) "Claude: opus"))
- (should (equal (car (nth 1 result)) "OpenAI: gpt-4o"))))
-
-(ert-deftest test-ai-config-build-model-list-normal-preserves-backend-object ()
- "Each entry should carry the original backend object for later use."
- (let* ((obj (vector 'struct "Claude"))
- (backends `(("Claude" . ,obj)))
- (result (cj/gptel--build-model-list backends (lambda (_) '("opus")))))
- (should (eq (nth 1 (nth 0 result)) obj))))
-
-(ert-deftest test-ai-config-build-model-list-normal-symbol-models-converted ()
- "Symbol model identifiers should be converted to strings via model-to-string."
- (let* ((backends '(("Claude" . backend-a)))
- (result (cj/gptel--build-model-list
- backends (lambda (_) '(opus sonnet)))))
- (should (equal (nth 2 (nth 0 result)) "opus"))
- (should (equal (nth 2 (nth 1 result)) "sonnet"))))
-
-;;; Boundary Cases
-
-(ert-deftest test-ai-config-build-model-list-boundary-empty-backends ()
- "Empty backends list should produce empty result."
- (should (null (cj/gptel--build-model-list nil (lambda (_) '("x"))))))
-
-(ert-deftest test-ai-config-build-model-list-boundary-backend-with-no-models ()
- "Backend returning no models should contribute no entries."
- (let* ((backends '(("Claude" . backend-a)))
- (result (cj/gptel--build-model-list backends (lambda (_) nil))))
- (should (null result))))
-
-(ert-deftest test-ai-config-build-model-list-boundary-mixed-empty-and-populated ()
- "Only backends with models should produce entries."
- (let* ((backends '(("Claude" . backend-a) ("Empty" . backend-b) ("OpenAI" . backend-c)))
- (result (cj/gptel--build-model-list
- backends
- (lambda (b)
- (cond ((eq b 'backend-a) '("opus"))
- ((eq b 'backend-b) nil)
- ((eq b 'backend-c) '("gpt-4o")))))))
- (should (= 2 (length result)))
- (should (equal (nth 3 (nth 0 result)) "Claude"))
- (should (equal (nth 3 (nth 1 result)) "OpenAI"))))
-
-(ert-deftest test-ai-config-build-model-list-boundary-model-with-special-characters ()
- "Model names with special characters should be preserved in display string."
- (let* ((backends '(("Claude" . backend-a)))
- (result (cj/gptel--build-model-list
- backends (lambda (_) '("claude-haiku-4-5-20251001")))))
- (should (equal (car (nth 0 result)) "Claude: claude-haiku-4-5-20251001"))))
-
-(provide 'test-ai-config-build-model-list)
-;;; test-ai-config-build-model-list.el ends here