aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-commands.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-pearl-commands.el')
-rw-r--r--tests/test-pearl-commands.el36
1 files changed, 32 insertions, 4 deletions
diff --git a/tests/test-pearl-commands.el b/tests/test-pearl-commands.el
index ccd39c8..64e38b4 100644
--- a/tests/test-pearl-commands.el
+++ b/tests/test-pearl-commands.el
@@ -78,16 +78,21 @@
;;; pearl-list-issues-by-project
-(ert-deftest test-pearl-list-issues-by-project-dispatches-with-project-id ()
- "Selecting a team and project forwards the project id to list-issues."
+(ert-deftest test-pearl-list-issues-by-project-dispatches-with-project-id-and-name ()
+ "Selecting a team and project forwards both id and name to list-issues, so
+the source can render 'Project issues: <name>'."
(let ((pid 'unset)
+ (pname 'unset)
(pearl-default-team-id nil))
(cl-letf (((symbol-function 'pearl-select-team) (lambda () '((id . "t1"))))
((symbol-function 'pearl-select-project)
(lambda (_t) '((id . "p1") (name . "Platform"))))
- ((symbol-function 'pearl-list-issues) (lambda (project-id) (setq pid project-id))))
+ ((symbol-function 'pearl-list-issues)
+ (lambda (project-id &optional project-name)
+ (setq pid project-id pname project-name))))
(pearl-list-issues-by-project)
- (should (string-equal "p1" pid)))))
+ (should (string-equal "p1" pid))
+ (should (string-equal "Platform" pname)))))
(ert-deftest test-pearl-list-issues-by-project-no-team-stops ()
"With no team selected, list-issues is not called."
@@ -149,5 +154,28 @@
(pearl-check-setup)
(should-not called))))
+;;; pearl-list-issues source construction (by-project me-lock fix)
+
+(ert-deftest test-pearl-list-issues-source-default-is-my-open-issues ()
+ "Without a project, pearl-list-issues is me-scoped and named 'My open issues'."
+ (let ((s (pearl--list-issues-source nil nil)))
+ (should (equal '(:assignee :me :open t) (car s)))
+ (should (string= "My open issues" (plist-get (cdr s) :name)))))
+
+(ert-deftest test-pearl-list-issues-source-project-drops-the-me-lock ()
+ "With a project id (and no name), the filter pins the project only -- no
+:assignee key -- and the source name is 'Project issues' (regression against
+the old me-locked by-project behavior)."
+ (let ((s (pearl--list-issues-source "proj-1" nil)))
+ (should (equal '(:project "proj-1" :open t) (car s)))
+ (should-not (plist-member (car s) :assignee))
+ (should (string= "Project issues" (plist-get (cdr s) :name)))))
+
+(ert-deftest test-pearl-list-issues-source-project-name-in-display ()
+ "With a project id and name, the source name reads 'Project issues: NAME'."
+ (let ((s (pearl--list-issues-source "proj-1" "Platform")))
+ (should (equal '(:project "proj-1" :open t) (car s)))
+ (should (string= "Project issues: Platform" (plist-get (cdr s) :name)))))
+
(provide 'test-pearl-commands)
;;; test-pearl-commands.el ends here