diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-pearl-saved-query-sync.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test-pearl-saved-query-sync.el b/tests/test-pearl-saved-query-sync.el index ceac5e6..8c98539 100644 --- a/tests/test-pearl-saved-query-sync.el +++ b/tests/test-pearl-saved-query-sync.el @@ -415,6 +415,26 @@ erased on every re-sync." (let ((shared-value (cdr (assoc "shared" captured-input)))) (should (eq :json-false shared-value)))))) +;;; pearl-sync-saved-query-to-linear — empty filter refusal + +(ert-deftest test-pearl-sync-empty-filter-refuses-before-scope-prompt () + "A saved query whose filter compiles to nil signals a clear user-error +before any scope prompt fires. Without the guard, the sync would pass +filterData=null to Linear, which rejects with an opaque error after the +user has already clicked through the scope picker." + (let ((pearl-saved-queries (copy-tree '(("EmptyFilter" :filter nil)))) + (scope-prompt-fired nil) + (api-called nil)) + (cl-letf (((symbol-function 'pearl--sync-saved-query-pick-scope) + (lambda (&rest _) (setq scope-prompt-fired t) + (list :team-id nil :team-name "Personal" :shared nil))) + ((symbol-function 'pearl--customview-create-async) + (lambda (&rest _) (setq api-called t)))) + (should-error (pearl-sync-saved-query-to-linear "EmptyFilter") + :type 'user-error) + (should-not scope-prompt-fired) + (should-not api-called)))) + ;;; pearl-publish-current-source (defmacro test-pearl-publish--in-buffer (source-form &rest body) |
