diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-04 13:27:39 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-04 13:27:39 -0500 |
| commit | 0bbed459fb60f1b9ebe0e137527aa44b75c4835e (patch) | |
| tree | f6117366fd616127997a2510ba984954e8b4a090 /tests/test-debug-wttrin-show-raw.el | |
| parent | de99a2930bbe65d7c2ea04656caa18823068c182 (diff) | |
| download | emacs-wttrin-0bbed459fb60f1b9ebe0e137527aa44b75c4835e.tar.gz emacs-wttrin-0bbed459fb60f1b9ebe0e137527aa44b75c4835e.zip | |
fix: debug-wttrin-show-raw serves cached data instead of fetching
A debug command should show what the API currently returns, not a
cached copy. Bind wttrin--force-refresh to t so the fetch always
bypasses the cache.
Diffstat (limited to 'tests/test-debug-wttrin-show-raw.el')
| -rw-r--r-- | tests/test-debug-wttrin-show-raw.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test-debug-wttrin-show-raw.el b/tests/test-debug-wttrin-show-raw.el index b447292..67e50ca 100644 --- a/tests/test-debug-wttrin-show-raw.el +++ b/tests/test-debug-wttrin-show-raw.el @@ -100,5 +100,22 @@ (should (get-buffer "*wttrin-debug*"))) (test-debug-wttrin-show-raw-teardown))) +(ert-deftest test-debug-wttrin-show-raw-normal-always-fetches-fresh () + "A debug command should always fetch from the API, not serve cached data. +When debugging, the user needs to see what the API currently returns." + (test-debug-wttrin-show-raw-setup) + (unwind-protect + (let ((force-refresh-was-set nil)) + ;; Seed cache so there IS data to serve + (testutil-wttrin-add-to-cache "Paris" "old cached data" 300) + (cl-letf (((symbol-function 'wttrin--get-cached-or-fetch) + (lambda (_location callback) + (setq force-refresh-was-set wttrin--force-refresh) + (funcall callback "fresh from API")))) + (debug-wttrin-show-raw "Paris") + ;; Force-refresh should have been active during the fetch + (should force-refresh-was-set))) + (test-debug-wttrin-show-raw-teardown))) + (provide 'test-debug-wttrin-show-raw) ;;; test-debug-wttrin-show-raw.el ends here |
