aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Griffith <griffitaj@gmail.com>2017-05-11 19:38:16 -0400
committerJohnson Denen <johnson.denen@gmail.com>2017-05-18 10:21:21 -0400
commit626e0e3ba4f435ea1c13507f2d4f66aee96aa8f8 (patch)
tree9ab6f0af7403128c0a595704da9d31aebfa433cd /test
parent72b2688030b8e1e2c81d1a9772aad35d1bf8ec7f (diff)
Fix for #84
changed more-json in mastodon-tl-tests to recieve an endpont more evocative names and fixed whitespace replaced remaining end eith endpoint-plist added basic unit tests for endpoint selection replaced equalp with equal in tests
Diffstat (limited to 'test')
-rw-r--r--test/mastodon-tl-tests.el46
1 files changed, 45 insertions, 1 deletions
diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el
index a91d6d5..3fb2c3b 100644
--- a/test/mastodon-tl-tests.el
+++ b/test/mastodon-tl-tests.el
@@ -101,7 +101,7 @@
(let ((mastodon-instance-url "https://instance.url"))
(with-mock
(mock (mastodon-http--get-json "https://instance.url/api/v1/timelines/foo?max_id=12345"))
- (mastodon-tl--more-json "foo" 12345))))
+ (mastodon-tl--more-json "timelines/foo" 12345))))
(ert-deftest mastodon-tl--byline-regular ()
"Should format the regular toot correctly."
@@ -236,3 +236,47 @@
| (B) (F) Account 42 (@acct42@example.space) Boosted Account 43 (@acct43@example.space) original time
------------")))))
+(ert-deftest mastodon-tl--endpoint-notifications ()
+ "Should return the appropriate endpoint string and update function format
+
+notifications."
+ (should
+ (and
+ (equal
+ 'mastodon-notifications--notifications
+ (plist-get (mastodon-tl--get-endpoint "notifications")
+ 'update-function))
+ (equal
+ "notifications"
+ (plist-get (mastodon-tl--get-endpoint "notifications")
+ 'endpoint)))))
+
+(ert-deftest mastodon-tl--endpoint-tag ()
+ "Should return the appropriate endpoint string and update function for
+
+tags."
+ (should
+ (and
+ (equal
+ 'mastodon-tl--timeline
+ (plist-get (mastodon-tl--get-endpoint "tag/test")
+ 'update-function))
+ (equal
+ "timelines/tag/test"
+ (plist-get (mastodon-tl--get-endpoint "tag/test")
+ 'endpoint)))))
+
+(ert-deftest mastodon-tl--endpoint-local ()
+ "Should return the appropriate endpoint string and update function for
+
+the local timeline."
+ (should
+ (and
+ (equal
+ 'mastodon-tl--timeline
+ (plist-get (mastodon-tl--get-endpoint "public?local=true")
+ 'update-function))
+ (equal
+ "timelines/public?local=true"
+ (plist-get (mastodon-tl--get-endpoint "public?local=true")
+ 'endpoint)))))