aboutsummaryrefslogtreecommitdiff
path: root/test/mastodon-toot-tests.el
diff options
context:
space:
mode:
authorHolger Dürer <me@hdurer.net>2021-11-09 18:24:54 +0100
committerHolger Dürer <me@hdurer.net>2021-11-10 20:12:12 +0100
commit522926bcca0caf45516da3dcd00c944066641965 (patch)
treea53083dd1483f06e7833e0e0dacbf080cff15293 /test/mastodon-toot-tests.el
parent5df05d94926ada6843cbc65aea4b64c18429fdf1 (diff)
Hamonize tests.
- Add a header comment explicitly switching off lexical binding - Harmonize naming (always start with module and double hyphen) - Ensure all tests have at least a minimal doc string. - Move tests from `mastodon-auth-test.el` to `mastodon-auth-tests.el`
Diffstat (limited to 'test/mastodon-toot-tests.el')
-rw-r--r--test/mastodon-toot-tests.el25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el
index 06da870..804c55a 100644
--- a/test/mastodon-toot-tests.el
+++ b/test/mastodon-toot-tests.el
@@ -1,6 +1,8 @@
+;;; mastodon-toot-test.el --- Tests for mastodon-toot.el -*- lexical-binding: nil -*-
+
(require 'el-mock)
-(defconst mastodon-toot-multi-mention
+(defconst mastodon-toot--multi-mention
'((mentions .
[((id . "1")
(username . "federated")
@@ -18,28 +20,37 @@
(defconst mastodon-toot-no-mention
'((mentions . [])))
-(ert-deftest toot-multi-mentions ()
+(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=
- (mastodon-toot--mentions mastodon-toot-multi-mention)
+ (mastodon-toot--mentions mastodon-toot--multi-mention)
"@local@local.social @federated@federated.social @federated@federated.cafe "))))
-(ert-deftest toot-multi-mentions-with-name ()
+(ert-deftest mastodon-toot--multi-mentions-with-name ()
+ "Should build a correct mention string omitting self.
+
+Here \"local\" is the user themselves and gets omitted from the
+mention string."
(let ((mastodon-auth--acct-alist
'(("https://local.social". "local")))
(mastodon-instance-url "https://local.social"))
(should (string=
- (mastodon-toot--mentions mastodon-toot-multi-mention)
+ (mastodon-toot--mentions mastodon-toot--multi-mention)
"@federated@federated.social @federated@federated.cafe "))))
-(ert-deftest toot-no-mention ()
+(ert-deftest mastodon-toot--no-mention ()
+ "Should construct an empty mention string 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) ""))))
-(ert-deftest cancel ()
+(ert-deftest mastodon-toot--cancel ()
+ "Should kill the buffer when cancelling the toot."
(with-mock
(mock (kill-buffer-and-window))
(mastodon-toot--cancel)