mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
fix org-roam--org-roam-file-p
fixes tests
This commit is contained in:
@ -416,7 +416,7 @@ first encapsulating ID."
|
|||||||
|
|
||||||
;;;;; Updating
|
;;;;; Updating
|
||||||
(defun org-roam-db-sync (&optional force)
|
(defun org-roam-db-sync (&optional force)
|
||||||
"Build the cache for `org-roam-directory'.
|
"Synchronize the cache state with the current Org files on-disk.
|
||||||
If FORCE, force a rebuild of the cache from scratch."
|
If FORCE, force a rebuild of the cache from scratch."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(when force (delete-file org-roam-db-location))
|
(when force (delete-file org-roam-db-location))
|
||||||
|
@ -194,7 +194,7 @@ Like `file-name-extension', but does not strip version number."
|
|||||||
"Return t if FILE is part of Org-roam system, nil otherwise.
|
"Return t if FILE is part of Org-roam system, nil otherwise.
|
||||||
If FILE is not specified, use the current buffer's file-path."
|
If FILE is not specified, use the current buffer's file-path."
|
||||||
(when-let ((path (or file
|
(when-let ((path (or file
|
||||||
(buffer-base-buffer (buffer-file-name)))))
|
(buffer-file-name (buffer-base-buffer)))))
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(and
|
(and
|
||||||
(org-roam--org-file-p path)
|
(org-roam--org-file-p path)
|
||||||
|
@ -23,31 +23,16 @@
|
|||||||
|
|
||||||
(require 'buttercup)
|
(require 'buttercup)
|
||||||
(require 'org-roam)
|
(require 'org-roam)
|
||||||
(require 'dash)
|
|
||||||
|
|
||||||
(defvar test-org-roam-directory (expand-file-name "tests/roam-files")
|
(describe "org-roam-db-sync"
|
||||||
"Directory containing org-roam test org files.")
|
|
||||||
|
|
||||||
(defun test-org-roam--init ()
|
|
||||||
"."
|
|
||||||
(let ((original-dir test-org-roam-directory)
|
|
||||||
(new-dir (expand-file-name (make-temp-name "org-roam") temporary-file-directory)))
|
|
||||||
(copy-directory original-dir new-dir)
|
|
||||||
(setq org-roam-directory new-dir)
|
|
||||||
(org-roam-setup)))
|
|
||||||
|
|
||||||
(defun test-org-roam--teardown ()
|
|
||||||
"."
|
|
||||||
(org-roam-teardown)
|
|
||||||
(delete-file org-roam-db-location)
|
|
||||||
(org-roam-db--close))
|
|
||||||
|
|
||||||
(describe "test files for org-roam-db-sync"
|
|
||||||
(before-all
|
(before-all
|
||||||
(test-org-roam--init))
|
(setq org-roam-directory (expand-file-name "tests/roam-files")
|
||||||
|
org-roam-db-location (expand-file-name "org-roam.db" temporary-file-directory))
|
||||||
|
(org-roam-setup))
|
||||||
|
|
||||||
(after-all
|
(after-all
|
||||||
(test-org-roam--teardown))
|
(org-roam-teardown)
|
||||||
|
(delete-file org-roam-db-location))
|
||||||
|
|
||||||
(it "has the correct number of files"
|
(it "has the correct number of files"
|
||||||
(expect (caar (org-roam-db-query [:select (funcall count) :from files]))
|
(expect (caar (org-roam-db-query [:select (funcall count) :from files]))
|
||||||
|
Reference in New Issue
Block a user