(tests): add test for headline extraction (#840)

This commit is contained in:
Jethro Kuan 2020-06-17 15:32:12 +08:00 committed by GitHub
parent 1276e801c0
commit 185f9877ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 0 deletions

View file

@ -0,0 +1,14 @@
#+TITLE: Headline
* Headline 1
:PROPERTIES:
:ID: e84d0630-efad-4017-9059-5ef917908823
:END:
* No headline here
Oops.
* Headline 2
:PROPERTIES:
:ID: 801b58eb-97e2-435f-a33e-ff59a2f0c213
:END:

View file

@ -225,6 +225,26 @@
:to-equal
'("t1" "t2 with space" "t3" "tags"))))))
(describe "Headline extraction"
(before-all
(test-org-roam--init))
(after-all
(test-org-roam--teardown))
(cl-flet
((test (fn file)
(let* ((fname (test-org-roam--abs-path file))
(buf (find-file-noselect fname)))
(with-current-buffer buf
(funcall fn fname)))))
(it "extracts headlines"
(expect (test #'org-roam--extract-headlines
"headlines/headline.org")
:to-equal
`(["e84d0630-efad-4017-9059-5ef917908823" ,(test-org-roam--abs-path "headlines/headline.org")]
["801b58eb-97e2-435f-a33e-ff59a2f0c213" ,(test-org-roam--abs-path "headlines/headline.org")])))))
;;; Tests
(xdescribe "org-roam-db-build-cache"
(before-each