diff options
author | Alexander Griffith <griffitaj@gmail.com> | 2018-03-05 21:45:45 -0500 |
---|---|---|
committer | Johnson Denen <johnson.denen@gmail.com> | 2018-03-05 21:52:15 -0500 |
commit | e9920d64b5283fca6a34b2144a5a35c4c1d02938 (patch) | |
tree | b6c875c5e88e72966440d3641ef37d320ee2d9fd /test | |
parent | b277114d7b3be3447eeecaf3ba7ac0b282a339fe (diff) |
Retoot add accts closes #155
When responding to toots the full acct for both local and federated accounts are now added to the new toot buffer.
Changes
- Added a function in mastodon.el to return the current user acct
- Added mastodon-toot--process-local, which takes an acct and appends the current server if it is local returns an empty string if the acct matches the current user and does only adds a prefix @ if the acct is federated
- mastodon-toot--mentions will return a formatted string of mentions or an empty string
- adds tests for mastodon-toot--mentions
- adds a missing , in mastodon-http--post
- `mastodon-toot--reply` now passes `mastodon-toot` a toot-id rather than the whole json
- 'mastodon-toot--reply-to-id is now a local var in a new toot
Diffstat (limited to 'test')
-rw-r--r-- | test/mastodon-toot-tests.el | 39 |
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)) |