aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-todo-keywords.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-pearl-todo-keywords.el')
-rw-r--r--tests/test-pearl-todo-keywords.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test-pearl-todo-keywords.el b/tests/test-pearl-todo-keywords.el
index b941b26..281beea 100644
--- a/tests/test-pearl-todo-keywords.el
+++ b/tests/test-pearl-todo-keywords.el
@@ -121,5 +121,34 @@
(let ((out (pearl--build-org-content '() '(:type filter :name "X" :filter nil) nil nil)))
(should (string-match-p "^#\\+TODO: TODO IN-PROGRESS IN-REVIEW BACKLOG BLOCKED \\| DONE$" out))))
+;;; --update-derived-todo-header (merge-refresh, final-buffer scan)
+
+(ert-deftest test-pearl-update-derived-todo-header-covers-buffer-headings ()
+ "The header rebuild scans the final buffer so every visible heading is declared."
+ (let ((org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE"))))
+ (with-temp-buffer
+ (insert "#+STARTUP: show3levels\n#+TODO: TODO | DONE\n\n"
+ "* View\n"
+ "** IN-PROGRESS Issue A\n:PROPERTIES:\n:LINEAR-ID: a\n:LINEAR-STATE-TYPE: started\n:END:\n"
+ "** DONE Issue B\n:PROPERTIES:\n:LINEAR-ID: b\n:LINEAR-STATE-TYPE: completed\n:END:\n")
+ (org-mode)
+ ;; no team states passed -- the rebuild comes purely from the buffer scan
+ (pearl--update-derived-todo-header '())
+ (goto-char (point-min))
+ (should (re-search-forward "^#\\+TODO: IN-PROGRESS \\| DONE$" nil t)))))
+
+(ert-deftest test-pearl-update-derived-todo-header-classifies-legacy-by-done-keyword ()
+ "A retained heading with no STATE-TYPE drawer is classified by org-done-keywords."
+ (let ((org-todo-keywords '((sequence "TODO" "|" "SHIPPED"))))
+ (with-temp-buffer
+ (insert "#+STARTUP: show3levels\n#+TODO: TODO | SHIPPED\n\n"
+ "* View\n"
+ "** SHIPPED Old Issue\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\n") ; no STATE-TYPE
+ (org-mode)
+ (pearl--update-derived-todo-header '())
+ (goto-char (point-min))
+ ;; SHIPPED is an org done-keyword, so it lands on the done side
+ (should (re-search-forward "^#\\+TODO: *\\| SHIPPED$" nil t)))))
+
(provide 'test-pearl-todo-keywords)
;;; test-pearl-todo-keywords.el ends here