aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-states.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-25 21:30:34 -0500
committerCraig Jennings <c@cjennings.net>2026-05-25 21:30:34 -0500
commit1de0623168d13c51fb9a7c8a87f89030642ae4d0 (patch)
treea4edf8b91ebafe8590145488f88b47a887ca716c /tests/test-pearl-states.el
parent60b51e1c996f1c8f152696946b9440f26ea9a956 (diff)
downloadpearl-1de0623168d13c51fb9a7c8a87f89030642ae4d0.tar.gz
pearl-1de0623168d13c51fb9a7c8a87f89030642ae4d0.zip
refactor(save): remove the immediate-state-push org-sync machinery
The opt-in org-sync mode pushed Linear state immediately — on every TODO-keyword cycle (the org-after-todo-state-change hook) and on every buffer save (the after-save hook scanning the whole file). That's the last immediate-push path, and it contradicts the one-write-path model the rest of v2 builds, so I removed it: pearl-enable-org-sync / -disable-org-sync, pearl-org-hook-function, pearl-sync-org-to-linear, pearl-sync-current-heading-to-linear, and the now-orphaned pearl--process-heading-at-point, pearl--map-org-state-to-linear, and pearl--update-issue-state-async. This finishes the "make org-sync private" task — there was nothing left to make private. Cycling a TODO keyword now marks state dirty (reconciled at the next save) instead of pushing. Saving the buffer pushes nothing. Re-introducing an auto-push on save is the separate "Automatic sync on save" task, which would call the save engine rather than this whole-file scanner. I kept pearl--extract-org-heading-properties and pearl--get-todo-states-pattern. They're general heading/keyword readers, not org-sync-specific, and the keyword-cycle save (the keyword-derivation follow-up) needs exactly them. The obsolete sync tests are replaced by two that assert the contract: the sync commands are gone, and a keyword cycle pushes nothing.
Diffstat (limited to 'tests/test-pearl-states.el')
-rw-r--r--tests/test-pearl-states.el36
1 files changed, 4 insertions, 32 deletions
diff --git a/tests/test-pearl-states.el b/tests/test-pearl-states.el
index 713cb78..ae8ef63 100644
--- a/tests/test-pearl-states.el
+++ b/tests/test-pearl-states.el
@@ -97,38 +97,10 @@
(pearl-update-issue-state "i-1" "Done" "team-1")
(should requested))))
-;;; pearl--update-issue-state-async -- nil-state-id guard
-
-(ert-deftest test-pearl-update-issue-state-async-nil-state-id-skips-request ()
- "The async update also short-circuits when the state name doesn't resolve."
- (let ((requested nil)
- (pearl-api-key "test-key"))
- (cl-letf (((symbol-function 'pearl--get-state-id-by-name) (lambda (_s _t) nil))
- ((symbol-function 'request) (lambda (&rest _) (setq requested t))))
- (pearl--update-issue-state-async "i-1" "Nonexistent" "team-1")
- (should-not requested))))
-
-(ert-deftest test-pearl-update-issue-state-async-success-runs ()
- "The async success handler runs on a successful update."
- (let ((pearl-api-key "test-key"))
- (cl-letf (((symbol-function 'pearl--get-state-id-by-name) (lambda (_s _t) "s2"))
- ((symbol-function 'request)
- (lambda (_url &rest args)
- (funcall (plist-get args :success)
- :data '((data (issueUpdate (success . t))))))))
- (should (progn (pearl--update-issue-state-async "i-1" "Done" "team-1") t)))))
-
-(ert-deftest test-pearl-update-issue-state-async-error-runs ()
- "The async error handler runs on a transport error."
- (let ((pearl-api-key "test-key"))
- (cl-letf (((symbol-function 'pearl--get-state-id-by-name) (lambda (_s _t) "s2"))
- ((symbol-function 'request)
- (lambda (_url &rest args)
- (funcall (plist-get args :error)
- :error-thrown "boom"
- :response (make-request-response :status-code 500)
- :data nil))))
- (should (progn (pearl--update-issue-state-async "i-1" "Done" "team-1") t)))))
+;; pearl--update-issue-state-async (the by-name state push) was removed with
+;; the org-sync path in save-model-v2. State now pushes through the save
+;; engine's pearl--save-state-field -> pearl--update-issue-async (stateId),
+;; covered in test-pearl-save.
(provide 'test-pearl-states)
;;; test-pearl-states.el ends here