diff options
author | martianh <martianh@noreply.codeberg.org> | 2022-12-26 05:31:39 +0000 |
---|---|---|
committer | martianh <martianh@noreply.codeberg.org> | 2022-12-26 05:31:39 +0000 |
commit | eb0f38d2635872fca07ffc88b14a2dfe12807bc7 (patch) | |
tree | 19c6a71d0b5b12ade04f1dcdb62de4a96fcfb2db /test | |
parent | 599cd053cdf4104c1739c40024a6586646a61eb4 (diff) | |
parent | 01ba30fd8649e4048ddd7d6cb3f644dd5d02edff (diff) |
Merge pull request 'Reply-to adds an extra whitespace after the list of mentions' (#343) from emocoder/mastodon.el:fix-two-spaces-in-reply into develop
Reviewed-on: https://codeberg.org/martianh/mastodon.el/pulls/343
Diffstat (limited to 'test')
-rw-r--r-- | test/mastodon-toot-tests.el | 37 |
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 () |