2022-06-12 00:07:24 +00:00
|
|
|
;;; tests.el --- Description -*- lexical-binding: t; -*-
|
|
|
|
;;
|
|
|
|
;; Copyright (C) 2022 Correl Roush
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; Commentary:
|
|
|
|
;;
|
|
|
|
;; Description
|
|
|
|
;;
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'ert)
|
2022-06-12 00:24:24 +00:00
|
|
|
(require 'org-roam)
|
2022-06-12 00:07:24 +00:00
|
|
|
(require 'org-roam-export)
|
|
|
|
|
2022-06-12 00:24:24 +00:00
|
|
|
(setq org-roam-directory (expand-file-name "./test-slipbox")
|
2022-06-12 06:33:43 +00:00
|
|
|
org-roam-db-location (expand-file-name "./test-slipbox/org-roam.db"))
|
2022-06-12 01:17:07 +00:00
|
|
|
(org-roam-update-org-id-locations)
|
2022-06-12 00:24:24 +00:00
|
|
|
(org-roam-db-sync)
|
|
|
|
|
|
|
|
|
2022-06-12 01:17:07 +00:00
|
|
|
(ert-deftest lorem-backlink-titles ()
|
|
|
|
(should (equal '("Ipsum > II")
|
2022-06-12 06:18:04 +00:00
|
|
|
(mapcar #'org-roam-export-backlink-title (org-roam-backlinks-get (org-roam-node-from-id "d12a1ce4-3199-42f4-b39b-b68c03458669") :unique t)))))
|
2022-06-12 01:17:07 +00:00
|
|
|
|
2022-06-12 06:36:30 +00:00
|
|
|
(ert-deftest ipsum-backlink-titles ()
|
|
|
|
(should (equal '("Lorem")
|
|
|
|
(mapcar #'org-roam-export-backlink-title (org-roam-backlinks-get (org-roam-node-from-id "e6c17c1a-6b05-40d2-a01f-b147633c51b1") :unique t)))))
|
|
|
|
|
2022-06-12 06:39:25 +00:00
|
|
|
(ert-deftest lorem-backlink-link ()
|
|
|
|
(should (equal '("id:e6c17c1a-6b05-40d2-a01f-b147633c51b1")
|
|
|
|
(mapcar #'org-roam-export-backlink-link (org-roam-backlinks-get (org-roam-node-from-id "d12a1ce4-3199-42f4-b39b-b68c03458669") :unique t)))))
|
|
|
|
|
|
|
|
(ert-deftest ipsum-backlink-link ()
|
|
|
|
(should (equal '("id:d12a1ce4-3199-42f4-b39b-b68c03458669")
|
|
|
|
(mapcar #'org-roam-export-backlink-link (org-roam-backlinks-get (org-roam-node-from-id "e6c17c1a-6b05-40d2-a01f-b147633c51b1") :unique t)))))
|
|
|
|
|
2022-06-12 06:07:29 +00:00
|
|
|
(ert-deftest lorem-backlink-excerpt ()
|
|
|
|
(should (equal '("Aliquam [[id:d12a1ce4-3199-42f4-b39b-b68c03458669][lorem]] ante, suscipit a lorem molestie, aliquet elementum eros. Proin
|
|
|
|
mattis lacus nec dapibus auctor. Donec lacinia finibus ex vitae tempor.
|
|
|
|
Suspendisse blandit, justo vitae placerat lacinia, eros tortor convallis nisi,
|
|
|
|
fermentum sodales lorem augue at ligula. Nulla facilisi. Curabitur vel convallis
|
|
|
|
tellus, a luctus mi. Donec sollicitudin erat erat, vel condimentum mauris tempus
|
|
|
|
eget. Pellentesque hendrerit suscipit risus eu fermentum. Vivamus non urna
|
|
|
|
commodo, lacinia odio vitae, blandit metus. Nam et tempus ipsum. Aenean lobortis
|
|
|
|
mauris sit amet lorem accumsan blandit. Fusce eleifend, tellus non tristique
|
|
|
|
auctor, ligula justo varius dolor, id bibendum nulla elit ac dui. Vestibulum
|
|
|
|
sodales enim eget tristique tempor.")
|
2022-06-12 06:18:04 +00:00
|
|
|
(mapcar #'org-roam-export-backlink-excerpt (org-roam-backlinks-get (org-roam-node-from-id "d12a1ce4-3199-42f4-b39b-b68c03458669") :unique t)))))
|
2022-06-12 06:07:29 +00:00
|
|
|
|
2022-06-12 06:36:30 +00:00
|
|
|
(ert-deftest ipsum-backlink-excerpt ()
|
|
|
|
(should (equal '("Lorem [[id:e6c17c1a-6b05-40d2-a01f-b147633c51b1][ipsum]] dolor sit amet, consectetur adipiscing elit. Mauris eget viverra mi.
|
|
|
|
Duis eget dui id tellus fermentum vehicula. Duis tincidunt quam vel erat
|
|
|
|
bibendum commodo. Phasellus in justo vitae magna commodo rhoncus id quis justo.
|
|
|
|
Morbi id malesuada nisi. Praesent ipsum velit, commodo vel bibendum vitae,
|
|
|
|
dignissim in magna. Pellentesque vehicula enim ante, interdum laoreet dolor
|
|
|
|
venenatis eget. Proin laoreet nulla a enim bibendum finibus. Proin mattis
|
|
|
|
lobortis quam non eleifend. Pellentesque vitae imperdiet nisl.")
|
|
|
|
(mapcar #'org-roam-export-backlink-excerpt (org-roam-backlinks-get (org-roam-node-from-id "e6c17c1a-6b05-40d2-a01f-b147633c51b1") :unique t)))))
|
|
|
|
|
2022-06-12 00:07:24 +00:00
|
|
|
(provide 'tests)
|
|
|
|
;;; tests.el ends here
|