diff options
author | mouse bot <mousebot@riseup.net> | 2021-11-12 16:50:57 +0000 |
---|---|---|
committer | mouse bot <mousebot@riseup.net> | 2021-11-12 16:50:57 +0000 |
commit | c2ff442e47751dc32407b312c78098b8dd3466a7 (patch) | |
tree | f348916cbbe0919ff08a6e076d151a69e31b7b0e /test/mastodon-toot-tests.el | |
parent | 1892014062229f3b68136495e53e90a51dfa58a1 (diff) | |
parent | eb922191259721d6b1b232de41bbd43ebdb10d2f (diff) |
Merge pull request 'Do a bit of work on tests' (#18) from h_d/mastodon.el:tests into develop
Reviewed-on: https://git.blast.noho.st/mouse/mastodon.el/pulls/18
Diffstat (limited to 'test/mastodon-toot-tests.el')
-rw-r--r-- | test/mastodon-toot-tests.el | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el index abc66d0..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,29 +20,38 @@ (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) - (mock-verify))) + (mock (kill-buffer-and-window)) + (mastodon-toot--cancel) + (mock-verify))) |