Test correct function

This commit is contained in:
erik 2024-05-17 18:10:13 +02:00
parent 4537956c41
commit 1143ba78a4

View file

@ -43,161 +43,162 @@
:remote_url nil, :remote_url nil,
:text_url nil}]) :text_url nil}])
(def link_prev {:card (def link_prev
{:description "forgejo - Beyond coding. We forge.", {:description "forgejo - Beyond coding. We forge.",
:author_url "", :author_url "",
:image_description "", :image_description "",
:width 290, :width 290,
:type "link", :type "link",
:embed_url "", :embed_url "",
:blurhash "URC3:FsU1xJS-8NvJ9$OFIS3wexEJ9n*xEbG", :blurhash "URC3:FsU1xJS-8NvJ9$OFIS3wexEJ9n*xEbG",
:title :title
"forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e", "forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e",
:published_at nil, :published_at nil,
:provider_name "Codeberg.org", :provider_name "Codeberg.org",
:language "en", :language "en",
:url :url
"https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go", "https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go",
:author_name "", :author_name "",
:image :image
"https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png", "https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png",
:provider_url "", :provider_url "",
:height 290, :height 290,
:html ""}}) :html ""})
(def statuses [{:mentions [] (def statuses
:emojis [] [{:mentions []
:tags [] :emojis []
:reblog :tags []
{:mentions [] :reblog
:emojis [] {:mentions []
:tags :emojis []
[{:name "hetzner" :tags
:url "https://social.meissa-gmbh.de/tags/hetzner"} [{:name "hetzner"
{:name "devops", :url "https://social.meissa-gmbh.de/tags/devops"} :url "https://social.meissa-gmbh.de/tags/hetzner"}
{:name "k8s", :url "https://social.meissa-gmbh.de/tags/k8s"} {:name "devops", :url "https://social.meissa-gmbh.de/tags/devops"}
{:name "cheap", :url "https://social.meissa-gmbh.de/tags/cheap"}] {:name "k8s", :url "https://social.meissa-gmbh.de/tags/k8s"}
:reblog nil {:name "cheap", :url "https://social.meissa-gmbh.de/tags/cheap"}]
:replies_count 0 :reblog nil
:in_reply_to_account_id nil :replies_count 0
:reblogs_count 1 :in_reply_to_account_id nil
:application nil :reblogs_count 1
:content :application nil
"mentioned: <p>We&apos;ve a new asciicast ... </p>" :content
:sensitive false "mentioned: <p>We&apos;ve a new asciicast ... </p>"
:favourites_count 2 :sensitive false
:in_reply_to_id nil :favourites_count 2
:poll nil :in_reply_to_id nil
:account :poll nil
{:acct "jerger" :account
:last_status_at "2020-06-14" {:acct "jerger"
:emojis [] :last_status_at "2020-06-14"
:bot false :emojis []
:group false :bot false
:following_count 64 :group false
:avatar_static :following_count 64
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/001/original/794ca61bfd71bbe1.jpg" :avatar_static
:fields "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/001/original/794ca61bfd71bbe1.jpg"
[{:name "blog" :fields
:value [{:name "blog"
"<a href=\"https://domaindrivenarchitecture.org/\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">domaindrivenarchitecture.org/</span><span class=\"invisible\"></span></a>" :value
:verified_at nil} "<a href=\"https://domaindrivenarchitecture.org/\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">domaindrivenarchitecture.org/</span><span class=\"invisible\"></span></a>"
{:name "interests" :verified_at nil}
:value "Clojure, sci-fi, tech, DevOps, public weal" {:name "interests"
:verified_at nil} :value "Clojure, sci-fi, tech, DevOps, public weal"
{:name "location" :verified_at nil}
:value "Reutlingen, de, eu" {:name "location"
:verified_at nil}] :value "Reutlingen, de, eu"
:username "jerger" :verified_at nil}]
:header_static :username "jerger"
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/001/original/2a45f78fa1af0815.jpg" :header_static
:discoverable true "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/001/original/2a45f78fa1af0815.jpg"
:statuses_count 135 :discoverable true
:header :statuses_count 135
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/001/original/2a45f78fa1af0815.jpg" :header
:note "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/001/original/2a45f78fa1af0815.jpg"
"<p>meissa GmbH, Maintainer, dda-pallet, Clojure, OpenSource, DevOps, DomainDrivenDesign, Demokratie, Bürgerbeteiligung, Europa, Klettern, Wandern</p>" :note
:locked false "<p>meissa GmbH, Maintainer, dda-pallet, Clojure, OpenSource, DevOps, DomainDrivenDesign, Demokratie, Bürgerbeteiligung, Europa, Klettern, Wandern</p>"
:id "1" :locked false
:avatar :id "1"
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/001/original/794ca61bfd71bbe1.jpg" :avatar
:url "https://social.meissa-gmbh.de/@jerger" "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/001/original/794ca61bfd71bbe1.jpg"
:display_name "jerger" :url "https://social.meissa-gmbh.de/@jerger"
:followers_count 24 :display_name "jerger"
:created_at "2019-06-02T10:41:41.919Z"} :followers_count 24
:card :created_at "2019-06-02T10:41:41.919Z"}
{:description :card
"We use our dda-k8s-crate to install kubernetes automatically with a nexux repository manager. See our GitHub page for more details :) https://github.com/DomainDrivenArchitecture/dda-k8s-crate" {:description
:author_url "" "We use our dda-k8s-crate to install kubernetes automatically with a nexux repository manager. See our GitHub page for more details :) https://github.com/DomainDrivenArchitecture/dda-k8s-crate"
:width 400 :author_url ""
:type "link" :width 400
:embed_url "" :type "link"
:title "Automatic kubernetes installation" :embed_url ""
:provider_name "" :title "Automatic kubernetes installation"
:url "https://asciinema.org/a/329800" :provider_name ""
:author_name "" :url "https://asciinema.org/a/329800"
:image :author_name ""
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/cache/preview_cards/images/000/024/180/original/8562ddca088c16e3.png" :image
:provider_url "" "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/cache/preview_cards/images/000/024/180/original/8562ddca088c16e3.png"
:height 311 :provider_url ""
:html ""} :height 311
:language "en" :html ""}
:id "104172691066899431" :language "en"
:url "https://social.meissa-gmbh.de/@jerger/104172691066899431" :id "104172691066899431"
:media_attachments [] :url "https://social.meissa-gmbh.de/@jerger/104172691066899431"
:uri :media_attachments []
"https://social.meissa-gmbh.de/users/jerger/statuses/104172691066899431" :uri
:visibility "public" "https://social.meissa-gmbh.de/users/jerger/statuses/104172691066899431"
:created_at "2020-05-15T13:25:19.190Z" :visibility "public"
:spoiler_text ""} :created_at "2020-05-15T13:25:19.190Z"
:replies_count 0 :spoiler_text ""}
:in_reply_to_account_id nil :replies_count 0
:reblogs_count 0 :in_reply_to_account_id nil
:application nil :reblogs_count 0
:content :application nil
"<p>We&apos;ve a new asciicast ... </p>" :content
:sensitive false "<p>We&apos;ve a new asciicast ... </p>"
:favourites_count 0 :sensitive false
:in_reply_to_id nil :favourites_count 0
:poll nil :in_reply_to_id nil
:account :poll nil
{:acct "team" :account
:last_status_at "2020-05-17" {:acct "team"
:emojis [] :last_status_at "2020-05-17"
:bot false :emojis []
:group false :bot false
:following_count 2 :group false
:avatar_static :following_count 2
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/002/original/1aaff0c626a2ade3.png" :avatar_static
:fields [] "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/002/original/1aaff0c626a2ade3.png"
:username "team" :fields []
:header_static :username "team"
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/002/original/2e6a592b61a2d505.jpg" :header_static
:discoverable true "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/002/original/2e6a592b61a2d505.jpg"
:statuses_count 12 :discoverable true
:header :statuses_count 12
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/002/original/2e6a592b61a2d505.jpg" :header
:note "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/headers/000/000/002/original/2e6a592b61a2d505.jpg"
"<p>DevOps, Cloud, KI, Clojure, Java, Python, Reutlingen, Tübingen, Stuttgart, genossenschaftlich, OpenSource, TestDriven, Maintainer</p>" :note
:locked false "<p>DevOps, Cloud, KI, Clojure, Java, Python, Reutlingen, Tübingen, Stuttgart, genossenschaftlich, OpenSource, TestDriven, Maintainer</p>"
:id "2" :locked false
:avatar :id "2"
"https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/002/original/1aaff0c626a2ade3.png" :avatar
:url "https://social.meissa-gmbh.de/@team" "https://cf.mastohost.com/v1/AUTH_91eb37814936490c95da7b85993cc2ff/socialmeissagmbhde/accounts/avatars/000/000/002/original/1aaff0c626a2ade3.png"
:display_name "meissa-team" :url "https://social.meissa-gmbh.de/@team"
:followers_count 3 :display_name "meissa-team"
:created_at "2019-06-02T10:50:28.976Z"} :followers_count 3
:card nil :created_at "2019-06-02T10:50:28.976Z"}
:language nil :card nil
:id "104183256213204298" :language nil
:url :id "104183256213204298"
"https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity" :url
:media_attachments [] "https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"
:uri :media_attachments []
"https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity" :uri
:visibility "public" "https://social.meissa-gmbh.de/users/team/statuses/104183256213204298/activity"
:created_at "2020-05-17T10:12:10.403Z" :visibility "public"
:spoiler_text ""}]) :created_at "2020-05-17T10:12:10.403Z"
:spoiler_text ""}])
(deftest test-mastodon->html (deftest test-mastodon->html
(is (= [:ul {:class "list-group"} (is (= [:ul {:class "list-group"}
@ -210,11 +211,11 @@
(deftest test-masto-media->html (deftest test-masto-media->html
(is (= hic/post-with-img (is (= hic/post-with-img
(sut/masto-media->html hic/post-base media_attachments)))) (sut/masto-media->html hic/post-base-img media_attachments))))
;(deftest test-masto-link-prev->html (deftest test-insert-link-prev
; (is (= hic/post-with-prev (is (= hic/post-with-prev
; (sut/masto-link-prev->html hic/post-base link_prev)))) (sut/insert-link-prev hic/post-base-prev))))
(deftest empty-card-should-produce-empty-result (deftest empty-card-should-produce-empty-result
(is (= nil (is (= nil