summaryrefslogtreecommitdiff
path: root/tests/test-calendar-sync--weekday-to-number.el
blob: bcad7917f7815dea896266a7cdd90f2db2516d02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
;;; test-calendar-sync--weekday-to-number.el --- Tests for weekday mapping -*- lexical-binding: t; -*-

;;; Commentary:
;; Tests for calendar-sync--weekday-to-number. Pure string→number mapping.

;;; Code:

(require 'ert)
(require 'testutil-calendar-sync)
(require 'calendar-sync)

;;; Normal Cases

(ert-deftest test-calendar-sync--weekday-to-number-normal-monday ()
  "MO maps to 1."
  (should (= 1 (calendar-sync--weekday-to-number "MO"))))

(ert-deftest test-calendar-sync--weekday-to-number-normal-all-days ()
  "All seven days map to 1-7."
  (should (equal '(1 2 3 4 5 6 7)
                 (mapcar #'calendar-sync--weekday-to-number
                         '("MO" "TU" "WE" "TH" "FR" "SA" "SU")))))

;;; Boundary Cases

(ert-deftest test-calendar-sync--weekday-to-number-boundary-sunday ()
  "SU maps to 7 (not 0)."
  (should (= 7 (calendar-sync--weekday-to-number "SU"))))

;;; Error Cases

(ert-deftest test-calendar-sync--weekday-to-number-error-invalid ()
  "Invalid weekday string returns nil."
  (should (null (calendar-sync--weekday-to-number "XX"))))

(provide 'test-calendar-sync--weekday-to-number)
;;; test-calendar-sync--weekday-to-number.el ends here