diff options
-rw-r--r-- | lisp/mastodon-tl.el | 8 | ||||
-rw-r--r-- | test/mastodon-tl-tests.el | 20 |
2 files changed, 26 insertions, 2 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index c44ac01..38aee76 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -354,7 +354,9 @@ also render the html" "&" "?") "max_id=" - (number-to-string id))))) + (if (numberp id ) + (number-to-string id) + id))))) (mastodon-http--get-json url))) ;; TODO @@ -367,7 +369,9 @@ also render the html" "&" "?") "since_id=" - (number-to-string id))))) + (if (numberp id) + (number-to-string id) + id))))) (mastodon-http--get-json url))) (defun mastodon-tl--property (prop &optional backward) diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el index 8c7dc4c..7d6a08f 100644 --- a/test/mastodon-tl-tests.el +++ b/test/mastodon-tl-tests.el @@ -104,6 +104,26 @@ (mock (mastodon-http--get-json "https://instance.url/api/v1/timelines/foo?max_id=12345")) (mastodon-tl--more-json "timelines/foo" 12345)))) +(ert-deftest more-json-id-string () + "Should request toots older than max_id. + +`mastodon-tl--more-json' should accept and id that is either +a string or a numeric." + (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 "timelines/foo" "12345")))) + +(ert-deftest update-json-id-string () + "Should request toots more recent than since_id. + +`mastodon-tl--updated-json' should accept and id that is either +a string or a numeric." + (let ((mastodon-instance-url "https://instance.url")) + (with-mock + (mock (mastodon-http--get-json "https://instance.url/api/v1/timelines/foo?since_id=12345")) + (mastodon-tl--updated-json "timelines/foo" "12345")))) + (ert-deftest mastodon-tl--relative-time-description () "Should format relative time as expected" (cl-labels ((minutes (n) (* n 60)) |