aboutsummaryrefslogtreecommitdiff
path: root/tests/test-chime-process-notifications.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-04-22 09:43:02 -0500
committerCraig Jennings <c@cjennings.net>2026-04-22 09:43:02 -0500
commit74ca4e066bc41ce0a6e94e2d4bc0c838df45a838 (patch)
tree0661131c768050815114bf6214b85abac3956771 /tests/test-chime-process-notifications.el
parent8511cf43f2bf4ab2dc539fd28427e6c81c98b901 (diff)
downloadchime-74ca4e066bc41ce0a6e94e2d4bc0c838df45a838.tar.gz
chime-74ca4e066bc41ce0a6e94e2d4bc0c838df45a838.zip
refactor: move 12 internal helpers from chime- to chime-- prefix
Before MELPA submission, tighten the public API surface. Single-dash chime-foo is the convention for user-facing commands and predicates that external code can bind. Anything that is not meant to be bound externally should use the double-dash chime--foo prefix so byte-compile warnings, docstrings, and MELPA package inspection all point in the same direction. Twelve helpers in chime.el had single-dash names but no user-facing role. They are not mentioned in README, they carry no interactive declaration, and their docstrings do not promise a behavior contract. Rename them: chime-get-minutes-into-day, chime-get-hours-minutes-from-time, chime-set-hours-minutes-for-time, chime-current-time-matches-time-of-day-string, chime-current-time-is-day-wide-time, chime-day-wide-notifications, chime-display-as-day-wide-event, chime-event-has-any-day-wide-timestamp, chime-event-within-advance-notice-window, chime-event-has-any-passed-time, chime-event-is-today, chime-environment-regex. The public API surface is now intentional. It covers chime-mode, chime-validate-configuration, chime-refresh-modeline, chime-done-keywords-predicate, and the chime-debug-* interactive commands in chime-debug.el. Breaking change. No alias shims because there are no downstream users yet.
Diffstat (limited to 'tests/test-chime-process-notifications.el')
-rw-r--r--tests/test-chime-process-notifications.el34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/test-chime-process-notifications.el b/tests/test-chime-process-notifications.el
index 181f146..75cac9b 100644
--- a/tests/test-chime-process-notifications.el
+++ b/tests/test-chime-process-notifications.el
@@ -59,7 +59,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(lambda (msg)
(setq notify-called t)
(push msg notify-messages)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event `((times . ((,timestamp-str . ,event-time)))
(title . "Team Meeting")
@@ -89,7 +89,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-count (1+ notify-count))))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event1 `((times . ((,timestamp-str-1 . ,event-time-1)))
(title . "Meeting 1")
@@ -117,7 +117,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (push msg notify-messages)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event1 `((times . ((,timestamp-str . ,event-time)))
(title . "Team Meeting")
@@ -146,9 +146,9 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-count (1+ notify-count))))
;; Mock day-wide time to return true
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () t))
- ((symbol-function 'chime-day-wide-notifications)
+ ((symbol-function 'chime--day-wide-notifications)
(lambda (events) (list "Day-wide alert"))))
(let* ((event `((times . ((,timestamp-str . ,event-time)))
(title . "All Day Event")
@@ -172,9 +172,9 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify) (lambda (msg) nil))
;; Mock day-wide time to return false
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil))
- ((symbol-function 'chime-day-wide-notifications)
+ ((symbol-function 'chime--day-wide-notifications)
(lambda (events)
(setq day-wide-called t)
'())))
@@ -198,7 +198,7 @@ REFACTORED: No timestamps used"
(let ((notify-called nil))
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-called t)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let ((events '()))
(chime--process-notifications events)
@@ -220,7 +220,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-called t)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event `((times . ((,timestamp-str . ,event-time)))
(title . "Future Event")
@@ -244,7 +244,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-count (1+ notify-count))))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event `((times . ((,timestamp-str . ,event-time)))
(title . "Single Event")
@@ -266,7 +266,7 @@ REFACTORED: No timestamps used"
(let ((notify-called nil))
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-called t)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
;; Should not error with nil events
(should-not (condition-case nil
@@ -287,7 +287,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-called t)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* (;; Invalid event: missing required fields
(events (list '((invalid . "structure")))))
@@ -311,7 +311,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-count (1+ notify-count))))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((valid-event `((times . ((,timestamp-str . ,event-time)))
(title . "Valid Event")
@@ -342,9 +342,9 @@ not one notification per event."
(lambda (msg)
(setq notify-count (1+ notify-count))
(push msg notify-messages)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () t))
- ((symbol-function 'chime-day-wide-notifications)
+ ((symbol-function 'chime--day-wide-notifications)
(lambda (events)
(list (cons "Blake's birthday is today" 'medium)
(cons "Holiday: Memorial Day is today" 'medium)
@@ -371,9 +371,9 @@ not one notification per event."
(lambda (msg)
(setq notify-count (1+ notify-count))
(push msg notify-messages)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () t))
- ((symbol-function 'chime-day-wide-notifications)
+ ((symbol-function 'chime--day-wide-notifications)
(lambda (events)
(list (cons "Blake's birthday is today" 'medium)))))
(chime--process-notifications '())