diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-pearl-labels.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test-pearl-labels.el b/tests/test-pearl-labels.el index 3872f31..94211b1 100644 --- a/tests/test-pearl-labels.el +++ b/tests/test-pearl-labels.el @@ -82,6 +82,27 @@ (should (string= "@eric" (pearl--assignee-tag '(:name "Eric")))) (should (string= "@eric_smith" (pearl--assignee-tag '(:name "Eric Smith"))))) +(ert-deftest test-pearl-assignee-tag-prefers-display-name () + "The tag uses Linear's short displayName (its @-mention handle), not the name +field -- which is the full email for teammates who never set a display name." + (should (string= "@nerses" + (pearl--assignee-tag '(:name "Nerses Ohanyan" :display-name "nerses")))) + (should (string= "@vrezh_mikayelyan" + (pearl--assignee-tag '(:name "vrezh.mikayelyan@deepsat.com" + :display-name "vrezh.mikayelyan"))))) + +(ert-deftest test-pearl-assignee-tag-falls-back-to-name () + "With no displayName, the tag slugs the name." + (should (string= "@eric_bell" (pearl--assignee-tag '(:name "Eric Bell"))))) + +(ert-deftest test-pearl-normalize-user-captures-display-name () + "The normalized user carries Linear's displayName so the @-tag can use the +short handle while the drawer keeps the fuller name." + (let ((u (pearl--normalize-user '((id . "u1") (name . "Nerses Ohanyan") + (displayName . "nerses") (email . "n@x"))))) + (should (string= "nerses" (plist-get u :display-name))) + (should (string= "Nerses Ohanyan" (plist-get u :name))))) + (ert-deftest test-pearl-assignee-tag-nil-when-unassigned () "No assignee yields no tag." (should-not (pearl--assignee-tag nil))) |
