aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-sync-hooks.el
blob: 0ee7d827e16e16259ad50fcbe7970f941169c04e (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;;; test-pearl-sync-hooks.el --- Tests for pearl org sync hooks -*- lexical-binding: t; -*-

;; Copyright (C) 2026 Craig Jennings

;; Author: Craig Jennings <c@cjennings.net>

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; Save-model-v2 removed the opt-in org-sync mode.  The after-save and
;; TODO-cycle hooks that pushed Linear state immediately are gone -- every push
;; now goes through the save engine (pearl-save-issue / pearl-save-all).  These
;; tests assert the removal: the sync commands no longer exist, and cycling a
;; TODO keyword pushes nothing.

;;; Code:

(require 'test-bootstrap (expand-file-name "test-bootstrap.el"))
(require 'cl-lib)

(ert-deftest test-pearl-org-sync-commands-removed ()
  "The opt-in org-sync mode and its push machinery no longer exist."
  (should-not (fboundp 'pearl-enable-org-sync))
  (should-not (fboundp 'pearl-disable-org-sync))
  (should-not (fboundp 'pearl-org-hook-function))
  (should-not (fboundp 'pearl-sync-org-to-linear))
  (should-not (fboundp 'pearl-sync-current-heading-to-linear)))

(ert-deftest test-pearl-keyword-cycle-pushes-nothing ()
  "Cycling a TODO keyword pushes nothing -- pearl wires no TODO-cycle sync hook."
  (let ((pushed nil))
    (cl-letf (((symbol-function 'pearl--update-issue-async)
               (lambda (&rest _) (setq pushed t))))
      (with-temp-buffer
        (let ((org-todo-keywords '((sequence "TODO" "DONE"))))
          (insert "*** TODO Title\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\n")
          (org-mode)
          (goto-char (point-min))
          (org-todo "DONE"))
        (should-not pushed)))))

(provide 'test-pearl-sync-hooks)
;;; test-pearl-sync-hooks.el ends here