add more variants for id reference & dislike

This commit is contained in:
Michael Jerger 2023-10-16 08:50:46 +02:00
parent 5a7a6653ab
commit 913b0bfe8e
2 changed files with 37 additions and 4 deletions

View file

@ -40,6 +40,12 @@
::Object ::Object
(sh/map-spec (s/keys :opt [::object])))) (sh/map-spec (s/keys :opt [::object]))))
;http://www.w3.org/ns/activitystreams#Dislike
(s/def ::Dislike
(s/and
::owl/Class
::Activity))
;http://www.w3.org/ns/activitystreams#Like ;http://www.w3.org/ns/activitystreams#Like
(s/def ::Like (s/def ::Like
(s/and (s/and

View file

@ -78,9 +78,25 @@
::sut/object {::sut/type "Note", ::sut/object {::sut/type "Note",
::sut/name "A Note"}}))) ::sut/name "A Note"}})))
(deftest Dislike-test
(testing "dislikes for mastodon notes"
(is (s/valid? ::sut/Dislike
{::sut/summary "Sally disliked a post",
::sut/type "Dislike",
::sut/actor {::sut/type "Person",
::sut/name "Sally"},
::sut/object "http://example.org/posts/1"}))
(testing "dislikes for forgejo repositories"
(is (s/valid? ::sut/Dislike
{::sut/id "https://repo.prod.meissa.de/activitypub/user-id/1/outbox/12346",
::sut/type "Dislike",
::sut/actor "https://repo.prod.meissa.de/activitypub/user-id/1",
::sut/object "https://codeberg.org/forgejo/forgejo.git"})))
))
(deftest Like-test (deftest Like-test
(testing "likes for mastodon notes" (testing "likes for mastodon notes"
(is (s/valid? ::sut/Like (is (s/valid? ::sut/Like
{::sut/summary "Sally liked a note", {::sut/summary "Sally liked a note",
::sut/type "Like", ::sut/type "Like",
::sut/actor {::sut/type "Person", ::sut/actor {::sut/type "Person",
@ -93,10 +109,21 @@
::sut/object "http://example.org/notes/1"}))) ::sut/object "http://example.org/notes/1"})))
(testing "likes for forgejo repositories" (testing "likes for forgejo repositories"
(is (s/valid? ::sut/Like (is (s/valid? ::sut/Like
{::sut/type "Like", {::sut/id "https://repo.prod.meissa.de/jem/like/12345",
::sut/type "Like",
::sut/actor "https://repo.prod.meissa.de/jem", ::sut/actor "https://repo.prod.meissa.de/jem",
::sut/object "https://codeberg.org/forgejo/forgejo.git"}))) ::sut/object "https://codeberg.org/forgejo/forgejo.git"}))
) (is (s/valid? ::sut/Like
{::sut/id "https://repo.prod.meissa.de/api/users/jem/like/12345",
::sut/type "Like",
::sut/actor "https://repo.prod.meissa.de/api/users/jem",
::sut/object "https://codeberg.org/forgejo/forgejo.git"}))
(is (s/valid? ::sut/Like
{::sut/id "https://repo.prod.meissa.de/activitypub/user-id/1/outbox/12345",
::sut/type "Like",
::sut/actor "https://repo.prod.meissa.de/activitypub/user-id/1",
::sut/object "https://codeberg.org/forgejo/forgejo.git"}))
))
(deftest Object-test (deftest Object-test
(is (s/valid? ::sut/Object (is (s/valid? ::sut/Object