aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-mapping.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-26 00:31:44 -0500
committerCraig Jennings <c@cjennings.net>2026-05-26 00:31:44 -0500
commit8c42615b09471db089d81b7d702c60917fb85c79 (patch)
tree34b847a3e92658ad5c6d1cc6f566ff6622c14495 /tests/test-pearl-mapping.el
parent5ee0bdcc4a1bd4b935973be7201b20380ec8cb80 (diff)
downloadpearl-8c42615b09471db089d81b7d702c60917fb85c79.tar.gz
pearl-8c42615b09471db089d81b7d702c60917fb85c79.zip
feat: resolve a cycled TODO keyword to its Linear state at save
Cycling a ticket's TODO keyword (C-c C-t) now counts as a state edit. The dirty scan gains a keyword-cycle arm: state is dirty when the explicit id moved off its baseline (the picker arm, as before) or when the keyword diverged from the synced state name's slug. At save, the picker arm pushes the explicit id; the keyword-cycle arm resolves the keyword to a team state id by slug match, first by position, and pushes that. A keyword no team state matches is reported skipped rather than guessed. set-heading-state now slugifies the keyword instead of the static-map lookup, so the picker writes the same keyword the renderer derives. Without that, a picker edit to a non-standard state would read as permanently cycled. That retires pearl--map-linear-state-to-org, whose only caller this was, and its tests.
Diffstat (limited to 'tests/test-pearl-mapping.el')
-rw-r--r--tests/test-pearl-mapping.el28
1 files changed, 7 insertions, 21 deletions
diff --git a/tests/test-pearl-mapping.el b/tests/test-pearl-mapping.el
index 2a96163..b5faa3d 100644
--- a/tests/test-pearl-mapping.el
+++ b/tests/test-pearl-mapping.el
@@ -37,27 +37,13 @@
(pearl--todo-states-pattern-source nil))
,@body))
-;;; pearl--map-linear-state-to-org
-
-(ert-deftest test-pearl-map-linear-state-to-org-mapped-returns-keyword ()
- "A Linear state present in the mapping returns its org keyword."
- (test-pearl--with-mapping '(("Todo" . "TODO") ("In Progress" . "DOING"))
- (should (string-equal "DOING" (pearl--map-linear-state-to-org "In Progress")))))
-
-(ert-deftest test-pearl-map-linear-state-to-org-unmapped-defaults-todo ()
- "An unmapped Linear state falls back to TODO."
- (test-pearl--with-mapping '(("Todo" . "TODO") ("Done" . "DONE"))
- (should (string-equal "TODO" (pearl--map-linear-state-to-org "Triage")))))
-
-(ert-deftest test-pearl-map-linear-state-to-org-nil-defaults-todo ()
- "A nil state falls back to TODO rather than erroring."
- (test-pearl--with-mapping '(("Todo" . "TODO"))
- (should (string-equal "TODO" (pearl--map-linear-state-to-org nil)))))
-
-;; pearl--map-org-state-to-linear (the keyword->state reverse map) was removed
-;; with the org-sync push path in save-model-v2; the keyword-cycle save will
-;; resolve through the team's states (the keyword-derivation task), not a flat
-;; reverse mapping.
+;; pearl--map-linear-state-to-org (the static name->keyword lookup) was removed
+;; in the keyword-cycle save: the keyword is now always the slug of the state
+;; name (`pearl--state-name-to-keyword'), matching the workspace-derived #+TODO
+;; header, and the keyword->state-id direction resolves through the team's
+;; states (`pearl--resolve-keyword-to-state'), not a flat mapping. The mapping
+;; alist itself survives only as the source for `pearl--get-todo-states-pattern'
+;; (tested below).
;;; pearl--get-todo-states-pattern