diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-10-15 11:54:28 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2023-10-15 11:54:28 +0200 |
commit | 574c17c4bdfe43a3081ddcbde4452dd477929c02 (patch) | |
tree | d700370b46aeed9ea8d1c3cf8ac5424e7ecc29b3 /test | |
parent | 9aac053495a08482d04f36c258a4e11d7ec92ea4 (diff) |
toot-id>item-id, toot-json>item-json, item-type for nav, byline still needed
Diffstat (limited to 'test')
-rw-r--r-- | test/mastodon-profile-tests.el | 4 | ||||
-rw-r--r-- | test/mastodon-tl-tests.el | 66 | ||||
-rw-r--r-- | test/mastodon-toot-tests.el | 10 |
3 files changed, 40 insertions, 40 deletions
diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el index 1936b99..d187e2d 100644 --- a/test/mastodon-profile-tests.el +++ b/test/mastodon-profile-tests.el @@ -158,11 +158,11 @@ When formatting Gargon's state we want to see t)) (should (equal - (get-text-property 4 'toot-id) + (get-text-property 4 'item-id) (alist-get 'id gargron-profile-json))) (should (equal - (get-text-property 4 'toot-json) + (get-text-property 4 'item-json) gargron-profile-json))))) (ert-deftest mastodon-profile--search-account-by-handle--removes-at () diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el index 899960e..be72f66 100644 --- a/test/mastodon-tl-tests.el +++ b/test/mastodon-tl-tests.el @@ -168,16 +168,16 @@ Strict-Transport-Security: max-age=31536000 (let ((input "foobar</p>")) (should (string= (mastodon-tl--remove-html input) "foobar\n\n")))) -(ert-deftest mastodon-tl--toot-id-boosted () +(ert-deftest mastodon-tl--item-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)) + (mastodon-tl--item-id mastodon-tl-test-base-boosted-toot)) "4543919"))) -(ert-deftest mastodon-tl--toot-id () +(ert-deftest mastodon-tl--item-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)) + (mastodon-tl--item-id mastodon-tl-test-base-toot)) "61208"))) (ert-deftest mastodon-tl--as-string-1 () @@ -926,19 +926,19 @@ constant." (insert "some text before\n") (setq toot-start (point)) (with-mock - (mock (mastodon-profile--get-preferences-pref - 'reading:expand:spoilers) - => :json-false) - (stub create-image => '(image "fake data")) - (stub shr-render-region => nil) ;; Travis's Emacs doesn't have libxml - (insert - (mastodon-tl--spoiler normal-toot-with-spoiler))) + (mock (mastodon-profile--get-preferences-pref + 'reading:expand:spoilers) + => :json-false) + (stub create-image => '(image "fake data")) + (stub shr-render-region => nil) ;; Travis's Emacs doesn't have libxml + (insert + (mastodon-tl--spoiler normal-toot-with-spoiler))) (setq toot-end (point)) (insert "\nsome more text.") (add-text-properties toot-start toot-end - (list 'toot-json normal-toot-with-spoiler - 'toot-id (cdr (assoc 'id normal-toot-with-spoiler)))) + (list 'item-json normal-toot-with-spoiler + 'item-id (cdr (assoc 'id normal-toot-with-spoiler)))) (goto-char toot-start) ;; (should (eq t (looking-at "This is the spoiler warning text"))) @@ -1147,28 +1147,28 @@ correct value for following, as well as notifications enabled or disabled." (let* ((toot mastodon-tl-test-base-toot) (account (alist-get 'account toot))) (with-mock - ;; no longer needed after our refactor - ;; (mock (mastodon-http--api "reports") => "https://instance.url/api/v1/reports") - ;; (mock (mastodon-tl--toot-or-base - ;; (mastodon-tl--property 'toot-json :no-move)) - ;; => mastodon-tl-test-base-toot) - (mock (read-string "Add comment [optional]: ") => "Dummy complaint") - (stub y-or-n-p => nil) ; no to all + ;; no longer needed after our refactor + ;; (mock (mastodon-http--api "reports") => "https://instance.url/api/v1/reports") + ;; (mock (mastodon-tl--toot-or-base + ;; (mastodon-tl--property 'item-json :no-move)) + ;; => mastodon-tl-test-base-toot) + (mock (read-string "Add comment [optional]: ") => "Dummy complaint") + (stub y-or-n-p => nil) ; no to all + (should (equal (mastodon-tl--report-params account toot) + '(("account_id" . 42) + ("comment" . "Dummy complaint") + ("category" . "other")))) + (with-mock + (stub y-or-n-p => t) ; yes to all + (mock (mastodon-tl--read-rules-ids) => '(1 2 3)) (should (equal (mastodon-tl--report-params account toot) - '(("account_id" . 42) + '(("rule_ids[]" . 3) + ("rule_ids[]" . 2) + ("rule_ids[]" . 1) + ("account_id" . 42) ("comment" . "Dummy complaint") - ("category" . "other")))) - (with-mock - (stub y-or-n-p => t) ; yes to all - (mock (mastodon-tl--read-rules-ids) => '(1 2 3)) - (should (equal (mastodon-tl--report-params account toot) - '(("rule_ids[]" . 3) - ("rule_ids[]" . 2) - ("rule_ids[]" . 1) - ("account_id" . 42) - ("comment" . "Dummy complaint") - ("status_ids[]" . 61208) - ("forward" . "true"))))))))) + ("status_ids[]" . 61208) + ("forward" . "true"))))))))) (ert-deftest mastodon-tl--report-build-params () "" diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el index 69333c0..5efe2e1 100644 --- a/test/mastodon-toot-tests.el +++ b/test/mastodon-toot-tests.el @@ -40,7 +40,7 @@ Transfer-Encoding: chunked") (defconst mastodon-toot--mock-toot (propertize "here is a mock toot text." - 'toot-json mastodon-toot-test-base-toot)) + 'item-json mastodon-toot-test-base-toot)) (defconst mastodon-toot--multi-mention '((mentions . @@ -143,7 +143,7 @@ mention string." (with-mock (mock (mastodon-auth--user-acct) => "joebogus") ;; (mock (mastodon-toot--own-toot-p toot) => nil) - (mock (mastodon-tl--property 'toot-json) => mastodon-toot-test-base-toot) + (mock (mastodon-tl--property 'item-json) => mastodon-toot-test-base-toot) (mock (mastodon-tl--property 'base-toot) => toot) (should (equal (mastodon-toot--delete-toot) "You can only delete (and redraft) your own toots."))))) @@ -155,7 +155,7 @@ mention string." (let ((delete-response (current-buffer)) (toot mastodon-toot-test-base-toot)) (with-mock - (mock (mastodon-tl--property 'toot-json) => toot) + (mock (mastodon-tl--property 'item-json) => toot) (mock (mastodon-tl--property 'base-toot) => toot) ;; (mock (mastodon-toot--own-toot-p toot) => t) (mock (mastodon-auth--user-acct) => "acct42@example.space") @@ -175,7 +175,7 @@ mention string." (toot mastodon-toot-test-base-toot) (id 61208)) (with-mock - (mock (mastodon-tl--property 'base-toot-id) => id) + (mock (mastodon-tl--property 'base-item-id) => id) (mock (mastodon-http--api "statuses/61208/pin") => "https://example.space/statuses/61208/pin") (mock (mastodon-http--post "https://example.space/statuses/61208/pin") @@ -190,7 +190,7 @@ mention string." (let ((pin-response (current-buffer)) (toot mastodon-toot-test-base-toot)) (with-mock - (mock (mastodon-tl--property 'toot-json) => toot) + (mock (mastodon-tl--property 'item-json) => toot) (mock (mastodon-tl--property 'base-toot) => toot) (mock (mastodon-auth--user-acct) => "joebogus@example.space") (should (equal (mastodon-toot--pin-toot-toggle) |