tests: close remaining contract gaps (action-dispatch, org-headline-add/find-by-id, tangle-sync, create-note, messaging-link/unlink)
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 5s

This commit is contained in:
2026-05-05 13:52:59 -04:00
parent 3d237e9c78
commit ad8242fee6
12 changed files with 150 additions and 22 deletions

View File

@@ -286,3 +286,23 @@ AST format: (:TYPE :HEADLINE :properties (:ID ... :TITLE ... :TAGS (...))
:contents nil)))
(org-todo-set ast "id:todo001" "DONE")
(is (string= (getf (getf ast :properties) :TODO) "DONE"))))
(test test-org-headline-add
"Contract 5: org-headline-add inserts a child headline."
(let* ((ast (list :type :HEADLINE
:properties (list :ID "root" :TITLE "Root")
:contents nil)))
(is (eq t (org-headline-add ast "root" "New Child")))
(is (= 1 (length (getf ast :contents))))
(is (string= "New Child" (getf (getf (first (getf ast :contents)) :properties) :TITLE)))))
(test test-org-headline-find-by-id
"Contract 6: org-headline-find-by-id finds a headline by ID."
(let ((ast (list :type :HEADLINE :properties (list :ID "root" :TITLE "Root")
:contents (list (list :type :HEADLINE :properties (list :ID "child1" :TITLE "Child"))
(list :type :HEADLINE :properties (list :ID "child2" :TITLE "Child 2")))))))
(let ((found (org-headline-find-by-id ast "child2")))
(is (not (null found)))
(is (string= "Child 2" (getf (getf found :properties) :TITLE))))
(let ((missing (org-headline-find-by-id ast "nonexistent")))
(is (null missing) "Missing ID should return nil"))))