branch: elpa/mastodon
commit 0e25cf98597fa38df2f301cbc7ff2f0caec6107c
Author: marty hiatt <martianhia...@disroot.org>
Commit: marty hiatt <martianhia...@disroot.org>

    fix mastodon-profile--format-user + test 
mastodon-profile--add-author-bylines.
---
 lisp/mastodon-profile.el       |  2 +-
 test/mastodon-profile-tests.el | 79 ++++++++++++++++++++++--------------------
 2 files changed, 42 insertions(+), 39 deletions(-)

diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 0b911d87b7..8c947334cd 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -890,7 +890,7 @@ Used to view a user's followers and those they're 
following."
            (insert
             "\n"
             (propertize
-             (mastodon-tl--byline-author `((account . ,toot)) :avatar)
+             (mastodon-tl--byline-author `((account . ,toot)) :avatar nil 
:base)
              'byline  't
              'item-id (alist-get 'id toot)
              'base-item-id (mastodon-tl--item-id toot)
diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el
index 289e8d97a1..efacd2ceec 100644
--- a/test/mastodon-profile-tests.el
+++ b/test/mastodon-profile-tests.el
@@ -122,48 +122,51 @@ When formatting Gargon's state we want to see
 - the url of the avatar (yet to be loaded)
 - the info attached to the name"
   (with-mock
-   ;; Don't start any image loading:
-   (mock (mastodon-media--inline-images * *) => nil)
-   ;; Let's not do formatting as that makes it hard to not rely on
-   ;; window width and reflowing the text.
-   (mock (shr-render-region * *) => nil)
-   (if (version< emacs-version "27.1")
-       (mock (image-type-available-p 'imagemagick) => t)
-     (mock (image-transforms-p) => t))
+    ;; Don't start any image loading:
+    (mock (mastodon-media--inline-images * *) => nil)
+    ;; Let's not do formatting as that makes it hard to not rely on
+    ;; window width and reflowing the text.
+    (mock (shr-render-region * *) => nil)
+    (if (version< emacs-version "27.1")
+        (mock (image-type-available-p 'imagemagick) => t)
+      (mock (image-transforms-p) => t))
 
-   (with-temp-buffer
-     (let ((mastodon-tl--show-avatars t)
-           (mastodon-tl--display-media-p t))
-       (mastodon-profile--format-user (list gargron-profile-json)))
+    (with-temp-buffer
+      (let ((mastodon-tl--show-avatars t)
+            (mastodon-tl--display-media-p t)
+            (username (mastodon-tl--unicode-wrap "Eugen"))
+            (handle (mastodon-tl--unicode-wrap "@Gargron")))
+        (mastodon-profile--format-user (list gargron-profile-json))
 
-     (should
-      (equal
-       (buffer-substring-no-properties (point-min) (point-max))
-       "\n  Eugen (@Gargron)\n<p>Developer of Mastodon and administrator of 
mastodon.social. I post service announcements, development updates, and 
personal stuff.</p>\n"))
+        (should
+         (equal
+          (buffer-substring-no-properties (point-min) (point-max))
+          (format "\n  %s (%s)\n<p>Developer of Mastodon and administrator of 
mastodon.social. I post service announcements, development updates, and 
personal stuff.</p>\n"
+                  username handle)))
 
-     ;; Check the avatar at pos 2
-     (should
-      (equal
-       (get-text-property 2 'media-url)
-       
"https://files.mastodon.social/accounts/avatars/000/000/001/original/d96d39a0abb45b92.jpg";))
-     (should
-      (equal
-       (get-text-property 2 'media-state)
-       'needs-loading))
+        ;; Check the avatar at pos 2
+        (should
+         (equal
+          (get-text-property 2 'media-url)
+          
"https://files.mastodon.social/accounts/avatars/000/000/001/original/d96d39a0abb45b92.jpg";))
+        (should
+         (equal
+          (get-text-property 2 'media-state)
+          'needs-loading))
 
-     ;; Check the byline state
-     (should
-      (equal
-       (get-text-property 4 'byline)
-       t))
-     (should
-      (equal
-       (get-text-property 4 'item-id)
-       (alist-get 'id gargron-profile-json)))
-     (should
-      (equal
-       (get-text-property 4 'item-json)
-       gargron-profile-json)))))
+        ;; Check the byline state
+        (should
+         (equal
+          (get-text-property 4 'byline)
+          t))
+        (should
+         (equal
+          (get-text-property 4 'item-id)
+          (alist-get 'id gargron-profile-json)))
+        (should
+         (equal
+          (get-text-property 4 'item-json)
+          gargron-profile-json))))))
 
 (ert-deftest mastodon-profile--search-account-by-handle--removes-at ()
   "Should ignore a leading at-sign in user handle.

Reply via email to