aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-favorites.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-16 16:49:08 -0500
committerCraig Jennings <c@cjennings.net>2026-06-16 16:49:08 -0500
commit0ab4afcd1e4e336cb69bd983e498bc441828ed5b (patch)
tree28c4d27cca4abb01198a12bf17692d3702ed1f7e /tests/test-pearl-favorites.el
parente723aa663ea62e5ddfda4a7ca360adf9e88d36e2 (diff)
downloadpearl-0ab4afcd1e4e336cb69bd983e498bc441828ed5b.tar.gz
pearl-0ab4afcd1e4e336cb69bd983e498bc441828ed5b.zip
fix(views): save a local view from any Custom View, not just favorites
pearl-save-linear-view-locally only listed favorited Linear views, while pearl-run-linear-view lists every Custom View in the workspace. A view you could run often wasn't offered to save, so the copy-down silently produced nothing. The command now saves the current buffer's view when one is showing, and otherwise prompts over all Custom Views. Favorited custom views also came through nameless: the favorites query fetched customView id but not name, and Linear leaves the favorite's title blank for entity favorites. The picker showed a blank entry and the save dead-ended at a blank name. The query now selects customView name and pearl--normalize-favorite falls back to it, which also fixes blank names in pearl-pick-source. The success message now names the saved view and how to run it or set it as the default.
Diffstat (limited to 'tests/test-pearl-favorites.el')
-rw-r--r--tests/test-pearl-favorites.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test-pearl-favorites.el b/tests/test-pearl-favorites.el
index 55808b3..3f1452f 100644
--- a/tests/test-pearl-favorites.el
+++ b/tests/test-pearl-favorites.el
@@ -56,6 +56,23 @@ For an issue node, IDENTIFIER fills the issue's user-facing key."
(should (string= "Active bugs" (plist-get p :title)))
(should (string= "view-1" (plist-get p :id)))))
+(ert-deftest test-pearl-normalize-favorite-custom-view-blank-title-uses-name ()
+ "A favorited custom view with a blank own title takes the customView's name.
+Linear populates Favorite.title only for favorite folders, so an entity favorite
+arrives with a null/empty title and the entity's own name is the only display
+string -- the favorites query selects customView.name for exactly this."
+ (let* ((node (list (cons 'id "fav-customView")
+ (cons 'type "customView")
+ (cons 'title nil)
+ (cons 'url "https://linear.app/x/view/v1")
+ (cons 'sortOrder 0.1)
+ (cons 'customView (list (cons 'id "view-1")
+ (cons 'name "Pearl Open Issues")))))
+ (p (pearl--normalize-favorite node)))
+ (should (eq 'view (plist-get p :kind)))
+ (should (string= "Pearl Open Issues" (plist-get p :title)))
+ (should (string= "view-1" (plist-get p :id)))))
+
(ert-deftest test-pearl-normalize-favorite-project ()
(let ((p (pearl--normalize-favorite
(test-pearl-fav--node "project" "Platform" "https://linear.app/x/project/p1" 0.2