Skip to content

Commit

Permalink
Add tests for referent pages for external packages (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
matsl authored Dec 23, 2024
1 parent 354fe30 commit f7ef219
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2024-12-23 Mats Lidell <[email protected]>

* test/hywiki-tests.el (hywiki-tests--add-activity)
(hywiki-tests--add-org-roam-node): Add tests.

2024-12-22 Bob Weiner <[email protected]>

* test/hywiki-tests.el (hywiki-tests--add-org-id): Fix so :type
Expand Down
24 changes: 21 additions & 3 deletions test/hywiki-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell
;;
;; Orig-Date: 18-May-24 at 23:59:48
;; Last-Mod: 22-Dec-24 at 16:22:44 by Bob Weiner
;; Last-Mod: 23-Dec-24 at 00:21:51 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -597,7 +597,16 @@ Note special meaning of `hywiki-allow-plurals-flag'."
(should (eq 'referent (hywiki-get-referent "WikiWord"))))
(hy-delete-dir-and-buffer hywiki-directory))))

;; hywiki-add-activity -- Requires activities
(ert-deftest hywiki-tests--add-activity ()
"Verify `hywiki-add-activity'."
(let ((hywiki-directory (make-temp-file "hywiki" t)))
(unwind-protect
(progn
(mocklet (((require 'activities) => t)
((hywiki-add-referent "WikiWord" '(activities-resume "activity" :resetp nil)) => 'activity-referent)
(activities-completing-read => "activity"))
(should (equal (hywiki-add-activity "WikiWord") 'activity-referent))))
(hy-delete-dir-and-buffer hywiki-directory))))

(ert-deftest hywiki-tests--add-bookmark ()
"Verify `hywiki-add-bookmark'."
Expand Down Expand Up @@ -693,7 +702,16 @@ Note special meaning of `hywiki-allow-plurals-flag'."
(error "(hywiki-tests--add-org-id): result value is a non-string: %s" result)))))
(hy-delete-file-and-buffer filea))))

;; hywiki-add-org-roam-node -- Requires org-roam
(ert-deftest hywiki-tests--add-org-roam-node ()
"Verify `hywiki-add-org-roam-node'."
(let ((hywiki-directory (make-temp-file "hywiki" t)))
(unwind-protect
(progn
(mocklet (((require 'org-roam) => t)
((org-roam-node-read) => "org-roam-node")
((hywiki-add-referent "WikiWord" '(org-roam-node-open "org-roam-node" (or (alist-get 'file org-link-frame-setup) (alist-get hpath:display-where hpath:display-where-alist)))) => 'org-roam-referent))
(should (equal (hywiki-add-org-roam-node "WikiWord") 'org-roam-referent))))
(hy-delete-dir-and-buffer hywiki-directory))))

(provide 'hywiki-tests)
;;; hywiki-tests.el ends here

0 comments on commit f7ef219

Please sign in to comment.