diff options
| -rw-r--r-- | pearl.el | 7 | ||||
| -rw-r--r-- | tests/test-pearl-format.el | 25 |
2 files changed, 32 insertions, 0 deletions
@@ -1894,6 +1894,8 @@ identifier prefix -- so an unedited heading is a no-op on title sync)." display-title (plist-get issue :identifier))) (label-names (mapconcat (lambda (l) (or (plist-get l :name) "")) (plist-get issue :labels) ", ")) + (label-ids (mapconcat (lambda (l) (or (plist-get l :id) "")) + (plist-get issue :labels) " ")) (body-org (pearl--md-to-org description))) (concat (format "** %s %s %s\n" todo priority heading-title) @@ -1907,11 +1909,16 @@ identifier prefix -- so an unedited heading is a no-op on title sync)." (format ":LINEAR-TEAM-NAME: %s\n" (or (plist-get team :name) "")) (format ":LINEAR-PROJECT-ID: %s\n" (or (plist-get project :id) "")) (format ":LINEAR-PROJECT-NAME: %s\n" (or (plist-get project :name) "")) + (format ":LINEAR-PRIORITY: %s\n" (or (plist-get issue :priority) "")) (format ":LINEAR-STATE-ID: %s\n" (or (plist-get state :id) "")) + (format ":LINEAR-STATE-ID-SYNCED: %s\n" (or (plist-get state :id) "")) (format ":LINEAR-STATE-NAME: %s\n" (or (plist-get state :name) "")) (format ":LINEAR-ASSIGNEE-ID: %s\n" (or (plist-get assignee :id) "")) + (format ":LINEAR-ASSIGNEE-ID-SYNCED: %s\n" (or (plist-get assignee :id) "")) (format ":LINEAR-ASSIGNEE-NAME: %s\n" (or (plist-get assignee :name) "")) (format ":LINEAR-LABELS: [%s]\n" label-names) + (format ":LINEAR-LABEL-IDS: %s\n" label-ids) + (format ":LINEAR-LABEL-IDS-SYNCED: %s\n" label-ids) (format ":LINEAR-DESC-SHA256: %s\n" (secure-hash 'sha256 description)) (format ":LINEAR-DESC-ORG-SHA256: %s\n" (secure-hash 'sha256 (string-trim body-org))) (format ":LINEAR-DESC-UPDATED-AT: %s\n" (or (plist-get issue :updated-at) "")) diff --git a/tests/test-pearl-format.el b/tests/test-pearl-format.el index 1e9fa53..a642b53 100644 --- a/tests/test-pearl-format.el +++ b/tests/test-pearl-format.el @@ -68,6 +68,31 @@ (should (string-match-p "^:LINEAR-TITLE-SHA256: +[0-9a-f]\\{64\\}$" out)) (should (string-match-p "^:END:$" out))))) +;;; synced baselines for structured fields (save-model v2) + +(ert-deftest test-pearl-format-issue-writes-synced-baselines () + "The renderer writes a synced baseline per structured field, equal to its live value at fetch." + (test-pearl--with-default-mapping + (let ((out (pearl--format-issue-as-org-entry (test-pearl--norm-full)))) + ;; priority: numeric baseline beside the cookie + (should (string-match-p "^:LINEAR-PRIORITY: +2$" out)) + ;; state: live id and synced baseline both present and equal + (should (string-match-p "^:LINEAR-STATE-ID: +state-1$" out)) + (should (string-match-p "^:LINEAR-STATE-ID-SYNCED: +state-1$" out)) + ;; assignee: live id and synced baseline equal + (should (string-match-p "^:LINEAR-ASSIGNEE-ID: +user-1$" out)) + (should (string-match-p "^:LINEAR-ASSIGNEE-ID-SYNCED: +user-1$" out)) + ;; labels: live id set and synced baseline equal, in fetched order + (should (string-match-p "^:LINEAR-LABEL-IDS: +lbl-1 lbl-2$" out)) + (should (string-match-p "^:LINEAR-LABEL-IDS-SYNCED: +lbl-1 lbl-2$" out))))) + +(ert-deftest test-pearl-format-issue-bare-empty-baselines () + "Null/missing structured fields render empty id baselines without error." + (test-pearl--with-default-mapping + (let ((out (pearl--format-issue-as-org-entry (test-pearl--norm-bare)))) + (should (string-match-p "^:LINEAR-LABEL-IDS: +$" out)) + (should (string-match-p "^:LINEAR-LABEL-IDS-SYNCED: +$" out))))) + (ert-deftest test-pearl-format-issue-description-in-body-not-property () "The description renders as body text, not a :DESCRIPTION: property." (test-pearl--with-default-mapping |
