From 5a8ede2990c208b1c4059092f21d216203bd0db5 Mon Sep 17 00:00:00 2001 From: Alexander Griffith Date: Wed, 28 Feb 2018 12:44:33 -0500 Subject: Closes #152 and extends the fix for #150 as well as a host of bug fixes We now kill the http get request buffer once JSON has been extracted. mastodon-tl--as-string was implemented and replaced any occurrence of number-to-string or int-to-string Added variable mastodon-tl--display-media-p. By default it is 't but can be made a local buffer variable and set to nil. When nil rather than displaying the media it just provides a link Media:: Fixed checking for faves and boosts, they should now render properly. The return from json-read-from-string for nil is :json-false which evaluates to 't in elisp. Fixed the format string that gets printed when faving and boosting Fixed mastodon-tl--thread updating and requesting and changed its behaviour such that it tries to open the original toot thread rather than the boosted thread. Added tests for both the new mastodon-tl--as-string function and the mastodon-tl--toot-id utility. enter mastodon mode before defining local buffer variable mastodon-tl--buffer-spec. This fixes some oddities with the local buffer variable. --- test/mastodon-tl-tests.el | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el index 7d6a08f..5d7699e 100644 --- a/test/mastodon-tl-tests.el +++ b/test/mastodon-tl-tests.el @@ -97,6 +97,28 @@ (let ((input "foobar

")) (should (string= (mastodon-tl--remove-html input) "foobar\n\n")))) +(ert-deftest toot-id-boosted () + "If a toot is boostedm, return the reblog id." + (should (string= (mastodon-tl--as-string + (mastodon-tl--toot-id mastodon-tl-test-base-boosted-toot)) + "4543919"))) + +(ert-deftest toot-id () + "If a toot is boostedm, return the reblog id." + (should (string= (mastodon-tl--as-string + (mastodon-tl--toot-id mastodon-tl-test-base-toot)) + "61208"))) + +(ert-deftest as-string-1 () + "Should accept a string or number and return a string." + (let ((id "1000")) + (should (string= (mastodon-tl--as-string id) id)))) + +(ert-deftest as-string-2 () + "Should accept a string or number and return a string." + (let ((id 1000)) + (should (string= (mastodon-tl--as-string id) (number-to-string id))))) + (ert-deftest more-json () "Should request toots older than max_id." (let ((mastodon-instance-url "https://instance.url")) -- cgit v1.2.3