aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-reverse-compile.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-pearl-reverse-compile.el')
-rw-r--r--tests/test-pearl-reverse-compile.el32
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/test-pearl-reverse-compile.el b/tests/test-pearl-reverse-compile.el
index 209d9a6..d298fb3 100644
--- a/tests/test-pearl-reverse-compile.el
+++ b/tests/test-pearl-reverse-compile.el
@@ -93,6 +93,24 @@
(ert-deftest test-pearl-rc-roundtrip-open-with-project ()
(test-pearl-rc--should-roundtrip '(:project "proj-9" :open t)))
+(ert-deftest test-pearl-rc-open-linear-canonical-two-type-nin ()
+ "Linear's UI authors open as state.type nin [completed, canceled] (no
+duplicate); it must reverse-compile to :open even though Pearl's own predicate
+adds duplicate."
+ (let ((r (test-pearl-rc--from-json
+ "{\"state\":{\"type\":{\"nin\":[\"completed\",\"canceled\"]}}}")))
+ (should (eq 'ok (car r)))
+ (should (equal (cdr r) '(:open t)))))
+
+(ert-deftest test-pearl-rc-open-linear-two-type-nin-with-project ()
+ "An open-issues-in-a-project Linear view (the copy-down that was refused) maps
+to :open + :project."
+ (let ((r (test-pearl-rc--from-json
+ "{\"state\":{\"type\":{\"nin\":[\"completed\",\"canceled\"]}},\"project\":{\"id\":{\"eq\":\"P9\"}}}")))
+ (should (eq 'ok (car r)))
+ (should (equal (plist-get (cdr r) :open) t))
+ (should (equal (plist-get (cdr r) :project) "P9"))))
+
(ert-deftest test-pearl-rc-roundtrip-project-team-cycle ()
(test-pearl-rc--should-roundtrip '(:project "P" :team "ENG" :cycle "C")))
@@ -180,10 +198,22 @@
(should (string-match-p "dueDate" (cdr r)))))
(ert-deftest test-pearl-rc-refuses-generic-nin ()
- "A state.type.nin that is not Pearl's exact open predicate refuses."
+ "A state.type.nin over an open type (started) is not the open predicate."
(should (eq 'refuse (car (test-pearl-rc--from-json
"{\"state\":{\"type\":{\"nin\":[\"started\"]}}}")))))
+(ert-deftest test-pearl-rc-refuses-nin-missing-canceled ()
+ "A nin excluding only completed still shows canceled issues, so it is not
+Pearl's open predicate and refuses rather than mapping to :open."
+ (should (eq 'refuse (car (test-pearl-rc--from-json
+ "{\"state\":{\"type\":{\"nin\":[\"completed\"]}}}")))))
+
+(ert-deftest test-pearl-rc-refuses-nin-excluding-open-type ()
+ "A nin that also excludes an open type (backlog) is a different filter, not
+open, and refuses."
+ (should (eq 'refuse (car (test-pearl-rc--from-json
+ "{\"state\":{\"type\":{\"nin\":[\"completed\",\"canceled\",\"backlog\"]}}}")))))
+
(ert-deftest test-pearl-rc-refuses-priority-out-of-range ()
(should (eq 'refuse (car (test-pearl-rc--from-json
"{\"priority\":{\"eq\":9}}")))))