diff --git a/src/main/cljc/org/domaindrivenarchitecture/fed_poc/activitystreams2.cljc b/src/main/cljc/org/domaindrivenarchitecture/fed_poc/activitystreams2.cljc index c33859f..22d24e8 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/fed_poc/activitystreams2.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/fed_poc/activitystreams2.cljc @@ -40,6 +40,12 @@ ::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 (s/def ::Like (s/and diff --git a/src/test/cljc/org/domaindrivenarchitecture/fed_poc/activitystreams2_test.cljc b/src/test/cljc/org/domaindrivenarchitecture/fed_poc/activitystreams2_test.cljc index 535c542..eeea9c7 100644 --- a/src/test/cljc/org/domaindrivenarchitecture/fed_poc/activitystreams2_test.cljc +++ b/src/test/cljc/org/domaindrivenarchitecture/fed_poc/activitystreams2_test.cljc @@ -78,9 +78,25 @@ ::sut/object {::sut/type "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 (testing "likes for mastodon notes" - (is (s/valid? ::sut/Like + (is (s/valid? ::sut/Like {::sut/summary "Sally liked a note", ::sut/type "Like", ::sut/actor {::sut/type "Person", @@ -93,10 +109,21 @@ ::sut/object "http://example.org/notes/1"}))) (testing "likes for forgejo repositories" (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/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 (is (s/valid? ::sut/Object