diff options
| author | Craig Jennings <c@cjennings.net> | 2026-11-20 15:59:47 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-11-20 15:59:47 -0600 |
| commit | 4df81e5e751cf50c45e1b82e694394ddcb133ada (patch) | |
| tree | 269e7d0dc65bf71965adc73c55858b2b7ae2f068 /archive/tests/test-telega-config.el | |
| parent | 1e679c7193f55950849cf9b9d9ac41108db26b3f (diff) | |
| download | dotemacs-4df81e5e751cf50c45e1b82e694394ddcb133ada.tar.gz dotemacs-4df81e5e751cf50c45e1b82e694394ddcb133ada.zip | |
refactor(telega): retire the Telegram client to the archive
I stopped using Telegram in Emacs, so the client goes to the archive.
- The module and its tests moved to archive/.
- The setup script and docker build files moved with them.
- I dropped the init.el require and the make telega-image target.
- The dashboard loses its Telegram launcher. Rows are now 5 4 2 2.
- C-; T is free again.
Diffstat (limited to 'archive/tests/test-telega-config.el')
| -rw-r--r-- | archive/tests/test-telega-config.el | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/archive/tests/test-telega-config.el b/archive/tests/test-telega-config.el new file mode 100644 index 00000000..54a601c9 --- /dev/null +++ b/archive/tests/test-telega-config.el @@ -0,0 +1,58 @@ +;;; test-telega-config.el --- Tests for Telegram (telega) module wiring -*- lexical-binding: t; -*- + +;;; Commentary: +;; Lightweight asserts that the module loads, exposes the launcher, +;; sets the docker preference, and registers the C-; G keybinding. +;; The bulk of telega.el's behaviour is owned upstream; the tests +;; here only cover what this config wires. + +;;; Code: + +(require 'ert) + +(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) +(require 'telega-config) + +(ert-deftest test-telega-config-loads-cleanly () + "Normal: module loads without errors and `provide's its feature." + (should (featurep 'telega-config))) + +(ert-deftest test-telega-config-launcher-binding-is-telega () + "Normal: =C-; T= invokes the launcher wrapper, which routes to +`telega' when installed or signals a helpful user-error otherwise. + +Was =C-; G= when `T' was contested between org-table and transcription +menus; both have moved (org-table flattened under `C-; O', +transcription cleared to M-x), so the natural mnemonic is free." + (should (eq (keymap-lookup cj/custom-keymap "T") #'cj/telega))) + +(ert-deftest test-telega-config-launcher-without-package-signals-user-error () + "Error: with telega absent, the launcher signals a `user-error' that +mentions the recovery path instead of falling through to the autoload +stub's cryptic load-file failure." + (cl-letf (((symbol-function 'featurep) + (lambda (sym &optional _sub) + (and (not (eq sym 'telega)) t))) + ((symbol-function 'locate-library) + (lambda (lib &rest _) (unless (equal lib "telega") t)))) + (let* ((err (should-error (cj/telega) :type 'user-error)) + (msg (error-message-string err))) + (should (string-match-p "telega not installed" msg)) + (should (string-match-p "setup-telega\\.sh\\|package-install" msg))))) + +(ert-deftest test-telega-config-launcher-with-package-calls-telega () + "Normal: with telega loadable, the launcher delegates to `telega'." + (let (called) + (cl-letf (((symbol-function 'featurep) + (lambda (sym &optional _sub) (eq sym 'telega))) + ;; The pinned image is a local build; treat it as present so + ;; this test stays about delegation, not the image check. + ((symbol-function 'cj/--telega-docker-image-present-p) + (lambda (_) t)) + ((symbol-function 'telega) + (lambda (&rest _) (setq called t)))) + (cj/telega)) + (should called))) + +(provide 'test-telega-config) +;;; test-telega-config.el ends here |
