aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-wttrin-saved-locations.el19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test-wttrin-saved-locations.el b/tests/test-wttrin-saved-locations.el
index 0a7b8b3..c2f44b8 100644
--- a/tests/test-wttrin-saved-locations.el
+++ b/tests/test-wttrin-saved-locations.el
@@ -300,7 +300,24 @@ now-deleted alias's resolved weather and re-fetches against the bare query."
((symbol-function 'message) (lambda (&rest _) nil)))
(wttrin-make-default)))
(should-not prompted)
- (should (equal "Craig's House" wttrin-favorite-location))))
+ (should (equal "Craig's House" wttrin-favorite-location))
+ (should (equal "1500 Sugar Bowl Dr"
+ (wttrin--resolve-location-query "Craig's House")))))
+
+(ert-deftest test-wttrin-saved-locations-normal-d-typed-saves-to-directory ()
+ "Normal: making a typed location the default also saves it to the directory,
+so it persists as a named entry rather than only as the favorite string."
+ (let ((wttrin-saved-locations nil)
+ (wttrin-favorite-location nil)
+ (wttrin-mode-line-mode nil))
+ (with-temp-buffer
+ (setq-local wttrin--current-location "Reykjavik")
+ (setq-local wttrin--current-display "Reykjavik")
+ (cl-letf (((symbol-function 'message) (lambda (&rest _) nil)))
+ (wttrin-make-default)))
+ (should (equal "Reykjavik" wttrin-favorite-location))
+ (should (assoc "Reykjavik" (wttrin--saved-locations)))
+ (should (equal "Reykjavik" (wttrin--resolve-location-query "Reykjavik")))))
;;; interactive entry smoke tests (cover the prompt forms)