Skip to content

Commit

Permalink
FIX/test.el: adjust tests to use new API
Browse files Browse the repository at this point in the history
  • Loading branch information
guidoschmidt committed Apr 21, 2024
1 parent 5203f15 commit 36d1ac8
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions test.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
time-now)))))
(with-mock
(stub circadian-now-time => '(5 0 0))
(circadian-activate-latest-theme)
(circadian-activate-and-schedule)

(should (equal (list 'adwaita) custom-enabled-themes)))

Expand All @@ -34,7 +34,7 @@
time-now)))))
(with-mock
(stub circadian-now-time => '(5 2 0))
(circadian-activate-latest-theme)
(circadian-activate-and-schedule)
(should (equal (list 'wombat) custom-enabled-themes)))

;; After 14:47, before 23:59
Expand All @@ -44,7 +44,7 @@
time-now)))))
(with-mock
(stub circadian-now-time => '(14 47 1))
(circadian-activate-latest-theme)
(circadian-activate-and-schedule)
(should (equal (list 'tango) custom-enabled-themes)))

;; After 23:59
Expand All @@ -54,7 +54,7 @@
time-now)))))
(with-mock
(stub circadian-now-time => '(23 59 15))
(circadian-activate-latest-theme)
(circadian-activate-and-schedule)
(should (equal (list 'adwaita) custom-enabled-themes)))

;; Surpassing midnight
Expand All @@ -64,23 +64,23 @@
time-now)))))
(with-mock
(stub circadian-now-time => '(0 2 10))
(circadian-activate-latest-theme)
(circadian-activate-and-schedule)
(should (equal (list 'adwaita) custom-enabled-themes))))



(ert-deftest test-circadian-activate-latest-theme ()
"Test `circadian-activate-latest-theme' used in `circadian-setup'."
;; (print "→ TEST: circadian-activate-latest-theme")
(ert-deftest test-circadian-activate-and-schedule ()
"Test `circadian-activate-and-schedule' used in `circadian-setup'."
;; (print "→ TEST: circadian-activate-and-schedule")
(setq circadian-themes '(("7:00" . wombat)
("16:00" . tango)))
(with-mock
(stub circadian-now-time => '(7 21 0))
(circadian-activate-latest-theme)
(circadian-activate-and-schedule)
(should (equal (list 'wombat) custom-enabled-themes)))
(with-mock
(stub circadian-now-time => '(17 0 0))
(circadian-activate-latest-theme)
(circadian-activate-and-schedule)
(should (equal (list 'tango) custom-enabled-themes))))


Expand All @@ -94,11 +94,11 @@
(setq circadian-themes '((:sunrise . adwaita)
(:sunset . wombat)))
(stub circadian-now-time => '(14 21 0))
(circadian-activate-latest-theme)
(circadian-activate-and-schedule)
(should (equal 'adwaita (cl-first custom-enabled-themes)))

(stub circadian-now-time => '(22 30 0))
(circadian-activate-latest-theme)
(circadian-activate-and-schedule)
(should (equal 'wombat (cl-first custom-enabled-themes)))))


Expand Down Expand Up @@ -153,13 +153,12 @@ https://github.com/guidoschmidt/circadian.el/issues/27"

(defvar test-order '(member
test-circadian-filter-and-activate-themes
test-circadian-activate-latest-theme
test-circadian-activate-and-schedule
test-circadian-sunrise-sunset
test-circadian-time-comparisons
test-circadian-setup-benchmark
test-circadian-invalid-solar-sunrise-sunset
test-circadian-sunrise-sunset-timezones
))
test-circadian-sunrise-sunset-timezones))

(provide 'circadian.el-test)
;;; circadian.el-test.el ends here

0 comments on commit 36d1ac8

Please sign in to comment.