From fb22826e6093f6ca334d61935cf2d926635ab1bc Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 5 Aug 2024 20:00:25 +0200 Subject: add 2 map alist tests --- test/mastodon-tl-tests.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') 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."))))) -- cgit v1.2.3