aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-integration-acceptance.el2
-rw-r--r--tests/test-pearl-comments.el28
-rw-r--r--tests/test-pearl-list-comments.el12
3 files changed, 29 insertions, 13 deletions
diff --git a/tests/test-integration-acceptance.el b/tests/test-integration-acceptance.el
index 37dce34..523d1b3 100644
--- a/tests/test-integration-acceptance.el
+++ b/tests/test-integration-acceptance.el
@@ -192,7 +192,7 @@ because the description-update mutation contains both `IssueDescription' and
(pearl-create-comment "looks good")
(should (memq 'comment-create test-integration--ops))
(goto-char (point-min))
- (should (re-search-forward "^\\*\\*\\* 💬 Comments 1/1$" nil t))
+ (should (re-search-forward "^\\*\\*\\* Comments 1/1$" nil t))
(should (re-search-forward "looks good" nil t))
;; --- edit the priority cookie, then save (reconcile-on-save) ---
(goto-char (point-min))
diff --git a/tests/test-pearl-comments.el b/tests/test-pearl-comments.el
index 323d7b7..0a0cb45 100644
--- a/tests/test-pearl-comments.el
+++ b/tests/test-pearl-comments.el
@@ -71,7 +71,7 @@
"With newest-first order, the most recent comment renders on top."
(let* ((pearl-comment-sort-order 'newest-first)
(out (pearl--format-comments test-pearl--two-comments)))
- (should (string-match-p "^\\*\\*\\* 💬 Comments$" out))
+ (should (string-match-p "^\\*\\*\\* Comments$" out))
(should (< (string-match "second" out) (string-match "first" out)))))
(ert-deftest test-pearl-format-comments-oldest-first ()
@@ -90,7 +90,7 @@
:state (:name "Todo") :description "Body text."
:comments ((:id "c1" :author "A" :created-at "2026-05-23T09:00:00.000Z"
:body "a comment"))))))
- (should (string-match-p "^\\*\\*\\* 💬 Comments$" out))
+ (should (string-match-p "^\\*\\*\\* Comments$" out))
(should (< (string-match "Body text." out) (string-match "a comment" out))))))
;;; --create-comment-async
@@ -120,23 +120,39 @@
;;; --append-comment-to-issue
(ert-deftest test-pearl-append-comment-creates-subtree ()
- "Appending to an issue with no Comments subtree creates one, glyphed and 1/1."
+ "Appending to an issue with no Comments subtree creates one with the 1/1 marker."
(test-pearl--in-org
"*** TODO [#B] Title\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\nBody.\n"
(pearl--append-comment-to-issue
'(:id "c1" :author "A" :created-at "2026-05-23T09:00:00.000Z" :body "first comment"))
(goto-char (point-min))
- (should (re-search-forward "^\\*\\*\\* 💬 Comments 1/1$" nil t))
+ (should (re-search-forward "^\\*\\*\\* Comments 1/1$" nil t))
(should (re-search-forward "first comment" nil t))))
(ert-deftest test-pearl-append-comment-bumps-count-marker ()
"Appending increments the shown/total count on an existing Comments heading."
(test-pearl--in-org
+ "** TODO [#B] Title\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\nBody.\n*** Comments 1/1\n**** A — 2026-05-23T09:00:00.000Z\nfirst\n"
+ (pearl--append-comment-to-issue
+ '(:id "c2" :author "B" :created-at "2026-05-23T12:00:00.000Z" :body "second"))
+ (goto-char (point-min))
+ (should (re-search-forward "^\\*\\*\\* Comments 2/2$" nil t))))
+
+(ert-deftest test-pearl-append-comment-locates-legacy-emoji-prefixed-heading ()
+ "The locator regex still finds a pre-existing `💬 Comments' heading.
+Buffers rendered between 2026-05-26 and the 💬-emoji revert carry the
+leading glyph; pearl--append-comment-to-issue should still find and
+extend them without re-rendering the file."
+ (test-pearl--in-org
"** TODO [#B] Title\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\nBody.\n*** 💬 Comments 1/1\n**** A — 2026-05-23T09:00:00.000Z\nfirst\n"
(pearl--append-comment-to-issue
'(:id "c2" :author "B" :created-at "2026-05-23T12:00:00.000Z" :body "second"))
(goto-char (point-min))
- (should (re-search-forward "^\\*\\*\\* 💬 Comments 2/2$" nil t))))
+ ;; The bump-count operates on the legacy heading; the new comment appears
+ ;; under it without a second Comments heading being added.
+ (should (re-search-forward "^\\*\\*\\* 💬 Comments 2/2$" nil t))
+ (goto-char (point-min))
+ (should-not (re-search-forward "^\\*\\*\\* Comments " nil t))))
(ert-deftest test-pearl-append-comment-newest-first-inserts-at-top ()
"With newest-first order, a new comment lands above the existing ones."
@@ -178,7 +194,7 @@
(re-search-forward "Body.")
(pearl-create-comment "my new comment")
(goto-char (point-min))
- (should (re-search-forward "^\\*\\*\\* 💬 Comments 1/1$" nil t))
+ (should (re-search-forward "^\\*\\*\\* Comments 1/1$" nil t))
(should (re-search-forward "my new comment" nil t)))))
(ert-deftest test-pearl-create-comment-reports-failure ()
diff --git a/tests/test-pearl-list-comments.el b/tests/test-pearl-list-comments.el
index a9517c9..751e220 100644
--- a/tests/test-pearl-list-comments.el
+++ b/tests/test-pearl-list-comments.el
@@ -20,7 +20,7 @@
;;; Commentary:
;; Tests for rendering comments in the bulk issue list: the per-issue cap
-;; (`pearl--cap-issue-list-comments'), the `💬 shown/total' marker
+;; (`pearl--cap-issue-list-comments'), the ` shown/total' marker
;; (`pearl--comment-count-marker', the Comments heading), and the way the
;; append locator tolerates the marked heading so a later add-comment finds the
;; existing subtree instead of creating a second one.
@@ -103,14 +103,14 @@
(let* ((pearl-comment-sort-order 'newest-first)
(comments (test-pearl--comments 5)) ; newest-first as fetched
(out (pearl--format-comments comments '(:shown 5 :total 12 :overflow nil))))
- (should (string-match-p "^\\*\\*\\* 💬 Comments 5/12$" out))
+ (should (string-match-p "^\\*\\*\\* Comments 5/12$" out))
;; newest (comment 5) renders before oldest (comment 1)
(should (< (string-match "comment 5\\b" out) (string-match "comment 1\\b" out)))))
(ert-deftest test-pearl-format-comments-no-marker-without-count ()
"Without count-info (the single-issue thread), the heading has no marker."
(let ((out (pearl--format-comments (test-pearl--comments 2))))
- (should (string-match-p "^\\*\\*\\* 💬 Comments$" out))))
+ (should (string-match-p "^\\*\\*\\* Comments$" out))))
;;; the marked heading is still found by the append locator
@@ -127,15 +127,15 @@
(org-mode)
(goto-char (point-min))
;; the rendered Comments heading carries the marker
- (should (re-search-forward "^\\*\\*\\* 💬 Comments 5/8$" nil t))
+ (should (re-search-forward "^\\*\\*\\* Comments 5/8$" nil t))
(goto-char (point-min))
(re-search-forward "issue")
(pearl--append-comment-to-issue
'(:id "cnew" :author "Z" :created-at "2026-06-01T00:00:00.000Z" :body "appended"))
;; exactly one Comments heading, and the new comment landed under it
(goto-char (point-min))
- (should (re-search-forward "^\\*\\*\\* 💬 Comments" nil t))
- (should-not (re-search-forward "^\\*\\*\\* 💬 Comments" nil t))
+ (should (re-search-forward "^\\*\\*\\* Comments" nil t))
+ (should-not (re-search-forward "^\\*\\*\\* Comments" nil t))
(should (string-match-p "appended" (buffer-string)))))))
(provide 'test-pearl-list-comments)