mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
test: fix org-roam-demote-entire-buffer leaving git dirty
The test was modifying tests/roam-files/demoteable.org directly, causing the file to be left in a modified state after test runs. This left git in a dirty state and caused subsequent test failures when the database expected the original file contents. Changed the test to use a temporary copy of the file instead, ensuring the original test data remains unmodified.
This commit is contained in:
@ -73,14 +73,16 @@
|
||||
(expect (org-roam-node-title node) :to-equal "Bruce Wayne"))))
|
||||
|
||||
(describe "org-roam-demote-entire-buffer"
|
||||
(after-each
|
||||
(cd root-directory))
|
||||
|
||||
(it "demotes an entire org buffer"
|
||||
(find-file "tests/roam-files/demoteable.org" nil)
|
||||
;; Use a temporary copy to avoid interfering with other tests
|
||||
(let ((temp-file (make-temp-file "test-demoteable-" nil ".org")))
|
||||
(copy-file "tests/roam-files/demoteable.org" temp-file t)
|
||||
(find-file temp-file)
|
||||
(org-roam-demote-entire-buffer)
|
||||
(expect (buffer-substring-no-properties (point) (point-max))
|
||||
:to-equal "* Demoteable\n:PROPERTIES:\n:ID: 97bf31cf-dfee-45d8-87a5-2ae0dabc4734\n:END:\n\n** Demoteable h1\n\n*** Demoteable child\n")))
|
||||
:to-equal "* Demoteable\n:PROPERTIES:\n:ID: 97bf31cf-dfee-45d8-87a5-2ae0dabc4734\n:END:\n\n** Demoteable h1\n\n*** Demoteable child\n")
|
||||
(kill-buffer)
|
||||
(delete-file temp-file))))
|
||||
|
||||
(describe "org-roam--h1-count"
|
||||
(after-each
|
||||
|
Reference in New Issue
Block a user