aboutsummaryrefslogtreecommitdiff
path: root/test/mastodon-toot-tests.el
diff options
context:
space:
mode:
authorJohnson Denen <johnson.denen@gmail.com>2018-03-05 22:09:37 -0500
committerGitHub <noreply@github.com>2018-03-05 22:09:37 -0500
commitae8dabda04e377a6ac22cb854e4844f68073f533 (patch)
treeb6c875c5e88e72966440d3641ef37d320ee2d9fd /test/mastodon-toot-tests.el
parente08bb5794762d22f90e85fd65cef7c143e6b9318 (diff)
parente9920d64b5283fca6a34b2144a5a35c4c1d02938 (diff)
Merge pull request #173 from jdenen/develop
Merge 0.7.2 into master
Diffstat (limited to 'test/mastodon-toot-tests.el')
-rw-r--r--test/mastodon-toot-tests.el39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el
index e9d3b26..3e25536 100644
--- a/test/mastodon-toot-tests.el
+++ b/test/mastodon-toot-tests.el
@@ -1,5 +1,44 @@
(require 'el-mock)
+(defconst mastodon-toot-multi-mention
+ '((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 . [])))
+
+(ert-deftest toot-multi-mentions ()
+ (let ((mastodon-auth--acct-alist '(("https://local.social". "null")))
+ (mastodon-instance-url "https://local.social"))
+ (should (string=
+ (mastodon-toot--mentions mastodon-toot-multi-mention)
+ "@local@local.social @federated@federated.social @federated@federated.cafe "))))
+
+(ert-deftest toot-multi-mentions-with-name ()
+ (let ((mastodon-auth--acct-alist
+ '(("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 "))))
+
+(ert-deftest toot-no-mention ()
+ (let ((mastodon-auth--acct-alist
+ '(("https://local.social". "null")))
+ (mastodon-instance-url "https://local.social"))
+ (should (string= (mastodon-toot--mentions mastodon-toot-no-mention) ""))))
+
(ert-deftest cancel ()
(with-mock
(mock (kill-buffer-and-window))