diff options
Diffstat (limited to 'tests/test-pearl-comment-editing.el')
| -rw-r--r-- | tests/test-pearl-comment-editing.el | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/test-pearl-comment-editing.el b/tests/test-pearl-comment-editing.el index 372cd95..32b194d 100644 --- a/tests/test-pearl-comment-editing.el +++ b/tests/test-pearl-comment-editing.el @@ -328,12 +328,21 @@ the refresh / add-comment / view-merge paths, never on the initial render." (when (find-buffer-visiting tmp) (kill-buffer (find-buffer-visiting tmp))) (ignore-errors (delete-file tmp))))) -(ert-deftest test-pearl-add-comment-from-inside-comment-refuses () - "Running add-comment from inside a comment subtree refuses — no issue id there." +(ert-deftest test-pearl-add-comment-from-inside-comment-walks-up () + "From inside a comment subtree, add-comment walks up to the enclosing issue and +adds the comment there rather than refusing." (test-pearl--in-org (test-pearl--comment-doc "u-me" "stored" "uniquecommentline") - (goto-char (point-min)) - (re-search-forward "uniquecommentline") ; point inside the comment subtree - (should-error (pearl-add-comment "hi") :type 'user-error))) + (let ((created-on nil)) + (cl-letf (((symbol-function 'pearl--create-comment-async) + (lambda (id _body cb) + (setq created-on id) + (funcall cb (list :id "cnew" :author "Me" + :created-at "2026-05-26T00:00:00.000Z" :body "hi"))))) + (goto-char (point-min)) + (re-search-forward "uniquecommentline") ; point inside the comment subtree + (pearl-add-comment "hi")) + ;; resolved the enclosing issue's LINEAR-ID ("a"), not the comment's + (should (equal "a" created-on))))) (ert-deftest test-pearl-edit-comment-missing-id-refuses-no-network () "A comment subtree without LINEAR-COMMENT-ID is refused with no network call." |
