aboutsummaryrefslogtreecommitdiff
path: root/test/mastodon-toot-tests.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-12-30 10:20:18 +1100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-12-30 10:20:18 +1100
commit0c17ad062d2550bfc752f6d2ed8513a0cd72ce56 (patch)
tree651540a0f832eda52e639f0b4e271360448b9f1a /test/mastodon-toot-tests.el
parentc8044cfdeaac2a43f4a7c25cbb8e6e2c32307a5c (diff)
parentac56ee7d12f98e1ff4f47fb0f354ec757ca73592 (diff)
Merge branch 'develop'
Diffstat (limited to 'test/mastodon-toot-tests.el')
-rw-r--r--test/mastodon-toot-tests.el37
1 files changed, 29 insertions, 8 deletions
diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el
index b88510c..69333c0 100644
--- a/test/mastodon-toot-tests.el
+++ b/test/mastodon-toot-tests.el
@@ -56,21 +56,33 @@ Transfer-Encoding: chunked")
(username . "local")
(url . "")
(acct . "local"))])))
-
(defconst mastodon-toot-no-mention
'((mentions . [])))
+(defconst mastodon-toot--multi-mention-extracted
+ '("local" "federated@federated.social" "federated@federated.cafe"))
+
(ert-deftest mastodon-toot--multi-mentions ()
"Should build a correct mention string from the test toot data.
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 (string=
+ (should (equal
(mastodon-toot--mentions mastodon-toot--multi-mention)
- "@local@local.social @federated@federated.social @federated@federated.cafe "))))
+ '("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.
+
+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 (string=
+ (mastodon-toot--mentions-to-string mastodon-toot--multi-mention-extracted)
+ "@local@local.social @federated@federated.social @federated@federated.cafe"))))
-(ert-deftest mastodon-toot--multi-mentions-with-name ()
+(ert-deftest mastodon-toot--multi-mentions-with-name-to-string ()
"Should build a correct mention string omitting self.
Here \"local\" is the user themselves and gets omitted from the
@@ -79,15 +91,24 @@ mention string."
'(("https://local.social". "local")))
(mastodon-instance-url "https://local.social"))
(should (string=
- (mastodon-toot--mentions mastodon-toot--multi-mention)
- "@federated@federated.social @federated@federated.cafe "))))
+ (mastodon-toot--mentions-to-string mastodon-toot--multi-mention-extracted)
+ "@federated@federated.social @federated@federated.cafe"))))
+
+(ert-deftest mastodon-toot--no-mention-to-string ()
+ "Should return and empty string."
+ (let ((mastodon-auth--acct-alist
+ '(("https://local.social". "local")))
+ (mastodon-instance-url "https://local.social"))
+ (should (string=
+ (mastodon-toot--mentions-to-string nil)
+ ""))))
(ert-deftest mastodon-toot--no-mention ()
- "Should construct an empty mention string without mentions."
+ "Should construct an empty mention list without mentions."
(let ((mastodon-auth--acct-alist
'(("https://local.social". "null")))
(mastodon-instance-url "https://local.social"))
- (should (string= (mastodon-toot--mentions mastodon-toot-no-mention) ""))))
+ (should (equal (mastodon-toot--mentions mastodon-toot-no-mention) nil))))
;; TODO: test y-or-no-p with mastodon-toot--cancel
(ert-deftest mastodon-toot--kill ()