aboutsummaryrefslogtreecommitdiff
path: root/test/mastodon-tl-tests.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2024-08-05 20:00:25 +0200
committermarty hiatt <martianhiatus@riseup.net>2024-08-05 20:00:25 +0200
commitfb22826e6093f6ca334d61935cf2d926635ab1bc (patch)
tree36bd19a515ae7950b59bad35e1874fd3cbf2d33c /test/mastodon-tl-tests.el
parenta5b048cca1a97070dc5ebb78bfc7f7d2ed64ea80 (diff)
add 2 map alist tests
Diffstat (limited to 'test/mastodon-tl-tests.el')
-rw-r--r--test/mastodon-tl-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el
index 2aa0505..e30d8df 100644
--- a/test/mastodon-tl-tests.el
+++ b/test/mastodon-tl-tests.el
@@ -1234,3 +1234,21 @@ correct value for following, as well as notifications enabled or disabled."
"We also do not accept hate speech."))
(should (equal '("2" "5" "6")
(mastodon-tl--read-rules-ids))))))
+
+
+;;; UTILS tests
+
+(ert-deftest mastodon-tl--map-alist ()
+ "Should return a list of values from `mastodon-tl--test-instance-rules'.
+The key is 'id."
+ (should (equal
+ (mastodon-tl--map-alist 'id mastodon-tl--test-instance-rules)
+ '("1" "2" "3" "4" "5" "6" "7" "8"))))
+
+(ert-deftest mastodon-tl--map-alist-vals-to-alist ()
+ "Should return an alist of value1 value2, using key1 id, and key2 text."
+ (should
+ (equal
+ (mastodon-tl--map-alist-vals-to-alist
+ 'id 'text mastodon-tl--test-instance-rules)
+ '(("1" . "We do not accept racism.") ("2" . "We do not accept homophobia.") ("3" . "We do not accept sexism.") ("4" . "We do not accept ableism.") ("5" . "We do not accept harassment.") ("6" . "We also do not accept hate speech.") ("7" . "We do not accept abuse of minors.") ("8" . "We do not accept glorification of violence.")))))