aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-merge.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-25 22:35:12 -0500
committerCraig Jennings <c@cjennings.net>2026-05-25 22:35:12 -0500
commit6924c27963ddd25f91ea3a1a02d462f0badabfc4 (patch)
tree9e87d325ee4155d9fce20da1dd9b17155acbaf29 /tests/test-pearl-merge.el
parent504133e600a197b50f05d3916264433ee9e4cb12 (diff)
downloadpearl-6924c27963ddd25f91ea3a1a02d462f0badabfc4.tar.gz
pearl-6924c27963ddd25f91ea3a1a02d462f0badabfc4.zip
feat(render): rebuild the derived #+TODO header on merge refresh
A same-source refresh updates issue subtrees in place and keeps retained dirty subtrees the merge skips, so the #+TODO line has to stay honest across it -- a refresh can surface a new state, and a kept heading's keyword must still be declared. pearl--update-derived-todo-header scans the final displayed buffer (every LINEAR-ID heading's TODO keyword + :LINEAR-STATE-TYPE: drawer), unions that with the fetched teams' states, and rewrites the line via pearl--derive-todo-line. Scanning the final buffer rather than the fetched issue list is what covers the retained subtrees. A legacy heading with no state-type drawer is classified by org-done-keywords. pearl--merge-query-result calls it after the merge, beside the source-header update. The merge and integration test setups stub pearl--team-states so the gather stays network-free.
Diffstat (limited to 'tests/test-pearl-merge.el')
-rw-r--r--tests/test-pearl-merge.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/test-pearl-merge.el b/tests/test-pearl-merge.el
index e55127b..ba73cc6 100644
--- a/tests/test-pearl-merge.el
+++ b/tests/test-pearl-merge.el
@@ -38,11 +38,15 @@
`(let ((pearl-state-to-todo-mapping
'(("Todo" . "TODO") ("In Progress" . "IN-PROGRESS") ("Done" . "DONE")))
(org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE"))))
- (with-temp-buffer
- (insert ,content)
- (org-mode)
- (goto-char (point-min))
- ,@body)))
+ ;; the merge's derived-header rebuild gathers team states synchronously;
+ ;; stub it so the merge tests stay network-free (the header then derives
+ ;; from the displayed issues' own states)
+ (cl-letf (((symbol-function 'pearl--team-states) (lambda (_team-id) nil)))
+ (with-temp-buffer
+ (insert ,content)
+ (org-mode)
+ (goto-char (point-min))
+ ,@body))))
(defun test-pearl-merge--issue (id title desc)
"A normalized issue plist with ID, TITLE, and DESC for merge input."