enhance like & dislike for repo star semantic
This commit is contained in:
parent
354948eb01
commit
0a97657443
4 changed files with 38 additions and 4 deletions
|
@ -5,8 +5,6 @@
|
||||||
[org.domaindrivenarchitecture.fed-poc.owl :as owl]
|
[org.domaindrivenarchitecture.fed-poc.owl :as owl]
|
||||||
[org.domaindrivenarchitecture.fed-poc.xsd :as xsd]))
|
[org.domaindrivenarchitecture.fed-poc.xsd :as xsd]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;=======================
|
;=======================
|
||||||
|
|
||||||
;http://www.w3.org/ns/activitystreams#Object
|
;http://www.w3.org/ns/activitystreams#Object
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[org.domaindrivenarchitecture.fed-poc.spec-helper :as sh]
|
[org.domaindrivenarchitecture.fed-poc.spec-helper :as sh]
|
||||||
[org.domaindrivenarchitecture.fed-poc.owl :as owl]
|
[org.domaindrivenarchitecture.fed-poc.owl :as owl]
|
||||||
|
[org.domaindrivenarchitecture.fed-poc.activitystreams2 :as as]
|
||||||
[org.domaindrivenarchitecture.fed-poc.xsd :as xsd]
|
[org.domaindrivenarchitecture.fed-poc.xsd :as xsd]
|
||||||
[org.domaindrivenarchitecture.fed-poc.activitystreams2 :as as]))
|
[org.domaindrivenarchitecture.fed-poc.activitystreams2 :as as]))
|
||||||
|
|
||||||
|
@ -12,3 +13,18 @@
|
||||||
(s/and
|
(s/and
|
||||||
::as/Object
|
::as/Object
|
||||||
(sh/map-spec (s/keys :opt []))))
|
(sh/map-spec (s/keys :opt []))))
|
||||||
|
|
||||||
|
;https://forgefed.org/ns#Star
|
||||||
|
(s/def ::Star
|
||||||
|
(s/merge
|
||||||
|
::as/Activity
|
||||||
|
(sh/map-spec (s/keys :opt [::flavour]))))
|
||||||
|
|
||||||
|
;https://forgefed.org/ns#Unstar
|
||||||
|
(s/def ::Unstar
|
||||||
|
(s/merge
|
||||||
|
::as/Activity
|
||||||
|
(sh/map-spec (s/keys :opt [::flavour]))))
|
||||||
|
|
||||||
|
(s/def ::flavour
|
||||||
|
(sh/seq-spec ::xsd/anyURI))
|
|
@ -107,7 +107,7 @@
|
||||||
::sut/type "Like",
|
::sut/type "Like",
|
||||||
::sut/actor "https://social.bla/alyssa",
|
::sut/actor "https://social.bla/alyssa",
|
||||||
::sut/object "http://example.org/notes/1"})))
|
::sut/object "http://example.org/notes/1"})))
|
||||||
(testing "likes for forgejo repositories - using public uris for id refernce"
|
(testing "likes for forgejo repositories"
|
||||||
(testing "using public uris for id refernce"
|
(testing "using public uris for id refernce"
|
||||||
(is (s/valid? ::sut/Like
|
(is (s/valid? ::sut/Like
|
||||||
{::sut/id "https://repo.prod.meissa.de/jem/like/12345",
|
{::sut/id "https://repo.prod.meissa.de/jem/like/12345",
|
||||||
|
|
|
@ -19,3 +19,23 @@
|
||||||
::sut/team "https://dev.example/aviva/treesim/team",
|
::sut/team "https://dev.example/aviva/treesim/team",
|
||||||
::sut/name "Tree Growth 3D Simulation",
|
::sut/name "Tree Growth 3D Simulation",
|
||||||
::sut/summary "<p>Tree growth 3D simulator for my nature exploration game</p>"})))
|
::sut/summary "<p>Tree growth 3D simulator for my nature exploration game</p>"})))
|
||||||
|
|
||||||
|
(deftest Star-test
|
||||||
|
(testing "stars for forgejo repositories"
|
||||||
|
(testing "using activitypub api uris for id refernce"
|
||||||
|
(is (s/valid? ::sut/Star
|
||||||
|
{::as/id "https://repo.prod.meissa.de/api/activitypub/user-id/1/outbox/12345",
|
||||||
|
::as/type "Star",
|
||||||
|
::sut/flavour "forgejo",
|
||||||
|
::as/actor "https://repo.prod.meissa.de/api/activitypub/user-id/1",
|
||||||
|
::as/object "https://codeberg.org/api/repos/forgejo/forgejo"})))))
|
||||||
|
|
||||||
|
(deftest Unstar-test
|
||||||
|
(testing "stars for forgejo repositories"
|
||||||
|
(testing "using activitypub api uris for id refernce"
|
||||||
|
(is (s/valid? ::sut/Unstar
|
||||||
|
{::as/id "https://repo.prod.meissa.de/api/activitypub/user-id/1/outbox/12345",
|
||||||
|
::as/type "Unstar",
|
||||||
|
::sut/flavour "forgejo",
|
||||||
|
::as/actor "https://repo.prod.meissa.de/api/activitypub/user-id/1",
|
||||||
|
::as/object "https://codeberg.org/api/repos/forgejo/forgejo"})))))
|
Loading…
Reference in a new issue