aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-08-05 19:51:44 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-08-05 19:51:44 +0200
commita5b048cca1a97070dc5ebb78bfc7f7d2ed64ea80 (patch)
treecf771e17711726ad7a4885e770d1eae7f7123dcb
parentab96a9b145d914541fafbb765b381f4d2bc880d7 (diff)
fix toot-multi-mentions test
-rw-r--r--test/mastodon-toot-tests.el31
1 files changed, 27 insertions, 4 deletions
diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el
index 62f6f86..694b4ee 100644
--- a/test/mastodon-toot-tests.el
+++ b/test/mastodon-toot-tests.el
@@ -56,6 +56,22 @@ Transfer-Encoding: chunked")
(username . "local")
(url . "")
(acct . "local"))])))
+
+(defconst mastodon-toot--multi-mention-list
+ '((mentions .
+ (((id . "1")
+ (username . "federated")
+ (url . "https://site.cafe/@federated")
+ (acct . "federated@federated.cafe"))
+ ((id . "1")
+ (username . "federated")
+ (url . "https://site.cafe/@federated")
+ (acct . "federated@federated.social"))
+ ((id . "1")
+ (username . "local")
+ (url . "")
+ (acct . "local"))))))
+
(defconst mastodon-toot-no-mention
'((mentions . [])))
@@ -67,10 +83,17 @@ Transfer-Encoding: chunked")
Even the local name \"local\" gets a domain name added."
(let ((mastodon-auth--acct-alist '(("https://local.social". "null")))
- (mastodon-instance-url "https://local.social"))
- (should (equal
- (mastodon-toot--mentions mastodon-toot--multi-mention)
- '("local" "federated@federated.social" "federated@federated.cafe")))))
+ (mastodon-instance-url "https://local.social")
+ (status mastodon-toot-test-base-toot))
+ (with-mock
+ ;; test-base-toot has no mentions so we mock some, using a list not an
+ ;; array as formerly
+ (mock (mastodon-tl--field 'mentions status)
+ => (alist-get 'mentions mastodon-toot--multi-mention-list))
+ (should (equal
+ (mastodon-toot--mentions mastodon-toot-test-base-toot)
+ ;; mastodon-toot--multi-mention) ; how did that ever work?
+ '("local" "federated@federated.social" "federated@federated.cafe"))))))
(ert-deftest mastodon-toot--multi-mentions-to-string ()
"Should build a correct mention string from the test toot data.