diff options
Diffstat (limited to 'tests/test-pearl-title-sync.el')
| -rw-r--r-- | tests/test-pearl-title-sync.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test-pearl-title-sync.el b/tests/test-pearl-title-sync.el index 512794c..fc84a15 100644 --- a/tests/test-pearl-title-sync.el +++ b/tests/test-pearl-title-sync.el @@ -53,6 +53,29 @@ "*** TODO [#B] My issue title :tag:\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\n" (should (string= "My issue title" (pearl--issue-title-at-point))))) +(ert-deftest test-pearl-issue-title-strips-identifier-prefix () + "The extractor strips the rendered `IDENT: ' prefix using the drawer identifier." + (test-pearl--in-org + "*** TODO [#B] SE-401: Fix the Bug\n:PROPERTIES:\n:LINEAR-ID: a\n:LINEAR-IDENTIFIER: SE-401\n:END:\n" + (should (string= "Fix the Bug" (pearl--issue-title-at-point))))) + +(ert-deftest test-pearl-title-render-read-roundtrip-is-noop () + "Rendering an issue then reading its heading back hashes to the stored title hash. +This is the property that keeps a fetch + unedited heading from pushing the +title-cased / identifier-prefixed display form to Linear." + (let ((pearl-show-identifier-in-heading t) + (pearl-title-case-headings t)) + (test-pearl--in-org + (pearl--format-issue-as-org-entry + '(:id "a" :identifier "SE-401" :title "fix the refresh bug" + :priority 2 :state (:name "Todo"))) + (goto-char (point-min)) + (re-search-forward "SE-401") + (let ((stored (org-entry-get nil "LINEAR-TITLE-SHA256")) + (read-back (pearl--issue-title-at-point))) + (should (string= "Fix the Refresh Bug" read-back)) + (should (string= stored (secure-hash 'sha256 read-back))))))) + ;;; network helpers (ert-deftest test-pearl-fetch-issue-title-parses-payload () |
