changed :opt-un to :opt

main
Clemens 10 months ago
parent 1f076b9192
commit 686fe41dee

@ -14,14 +14,14 @@
(s/def ::Object (s/def ::Object
(s/and (s/and
::owl/Class ::owl/Class
(sh/map-spec (s/keys :opt-un [::id ::type ::attachment ::bcc ::bto ::cc ::to])))) (sh/map-spec (s/keys :opt [::id ::type ::attachment ::bcc ::bto ::cc ::to]))))
;http://www.w3.org/ns/activitystreams#Link ;http://www.w3.org/ns/activitystreams#Link
;TODO: definition in progress ;TODO: definition in progress
(s/def ::Link (s/def ::Link
(s/and (s/and
::owl/Class ::owl/Class
(sh/map-spec (s/keys :opt-un [::id ::type])))) (sh/map-spec (s/keys :opt [::id ::type]))))
;http://www.w3.org/ns/activitystreams#Activity ;http://www.w3.org/ns/activitystreams#Activity
;TODO: Define more properties necessary for Like ;TODO: Define more properties necessary for Like
@ -29,7 +29,7 @@
(s/and (s/and
::owl/Class ::owl/Class
::Object ::Object
(sh/map-spec (s/keys :opt-un [::result ::object ::actor])))) (sh/map-spec (s/keys :opt [::result ::object ::actor]))))
;http://www.w3.org/ns/activitystreams#Relationship ;http://www.w3.org/ns/activitystreams#Relationship
;We only have this class, since the property "object" is in the domain "Activity" and "Relationship" ;We only have this class, since the property "object" is in the domain "Activity" and "Relationship"
@ -38,7 +38,7 @@
(s/and (s/and
::owl/Class ::owl/Class
::Object ::Object
(sh/map-spec (s/keys :opt-un [::object])))) (sh/map-spec (s/keys :opt [::object]))))
;http://www.w3.org/ns/activitystreams#Like ;http://www.w3.org/ns/activitystreams#Like
(s/def ::Like (s/def ::Like

@ -25,36 +25,36 @@
(deftest object-test (deftest object-test
(is (s/valid? ::sut/object "http://example.org/posts/1")) (is (s/valid? ::sut/object "http://example.org/posts/1"))
(is (s/valid? ::sut/object {:type "Note", (is (s/valid? ::sut/object {::sut/type "Note",
:content "A simple note"})) ::sut/content "A simple note"}))
(is (s/valid? ::sut/object ["http://example.org/posts/1", (is (s/valid? ::sut/object ["http://example.org/posts/1",
{:type "Note", {::sut/type "Note",
:summary "A simple note", ::sut/summary "A simple note",
:content "That is a tree."}]))) ::sut/content "That is a tree."}])))
(deftest result-test (deftest result-test
(is (s/valid? ::sut/result "https://social.bla/alyssa/result/RANDOMHASH")) (is (s/valid? ::sut/result "https://social.bla/alyssa/result/RANDOMHASH"))
(is (s/valid? ::sut/result {:type "http://www.types.example/flightstatus", :name "On Time"})) (is (s/valid? ::sut/result {::sut/type "http://www.types.example/flightstatus", ::sut/name "On Time"}))
(is (s/valid? ::sut/result {:type "Link" :href "http://www.target.de"})) (is (s/valid? ::sut/result {::sut/type "Link" ::sut/href "http://www.target.de"}))
(is (not (s/valid? ::sut/result nil))) (is (not (s/valid? ::sut/result nil)))
(is (not (s/valid? ::sut/result 47)))) (is (not (s/valid? ::sut/result 47))))
(deftest attachment-test (deftest attachment-test
(is (s/valid? ::sut/attachment (is (s/valid? ::sut/attachment
[{:type "Image", [{::sut/type "Image",
:content "This is what he looks like.", ::sut/content "This is what he looks like.",
:url "http://example.org/cat.jpeg"}]))) ::sut/url "http://example.org/cat.jpeg"}])))
(deftest actor-test (deftest actor-test
(is (s/valid? ::sut/actor "http://sally.example.org")) (is (s/valid? ::sut/actor "http://sally.example.org"))
(is (s/valid? ::sut/actor {:type "Person", (is (s/valid? ::sut/actor {::sut/type "Person",
:id "http://sally.example.org", ::sut/id "http://sally.example.org",
:summary "Sally"})) ::sut/summary "Sally"}))
(is (s/valid? ::sut/actor ["http://joe.example.org", (is (s/valid? ::sut/actor ["http://joe.example.org",
{:type "Person", {::sut/type "Person",
:id "http://sally.example.org", ::sut/id "http://sally.example.org",
:name "Sally"}]))) ::sut/name "Sally"}])))
(deftest bcc-test (deftest bcc-test
(is (s/valid? ::sut/bcc ["http://joe.example.org"]))) (is (s/valid? ::sut/bcc ["http://joe.example.org"])))
@ -70,34 +70,34 @@
(deftest Activity-test (deftest Activity-test
(is (s/valid? ::sut/Activity (is (s/valid? ::sut/Activity
{:type "Activity", {::sut/type "Activity",
:summary "Sally did something to a note", ::sut/summary "Sally did something to a note",
:actor {:type "Person", ::sut/actor {::sut/type "Person",
:name "Sally"}, ::sut/name "Sally"},
:object {:type "Note", ::sut/object {::sut/type "Note",
:name "A Note"}}))) ::sut/name "A Note"}})))
(deftest Like-test (deftest Like-test
(is (s/valid? ::sut/Like (is (s/valid? ::sut/Like
{:summary "Sally liked a note", {::sut/summary "Sally liked a note",
:type "Like", ::sut/type "Like",
:actor {:type "Person", ::sut/actor {::sut/type "Person",
:name "Sally"}, ::sut/name "Sally"},
:object "http://example.org/notes/1"})) ::sut/object "http://example.org/notes/1"}))
(is (s/valid? ::sut/Like (is (s/valid? ::sut/Like
{:id "foo", {::sut/id "foo",
:type "Like", ::sut/type "Like",
:actor "https://social.bla/alyssa", ::sut/actor "https://social.bla/alyssa",
:object "http://example.org/notes/1"}))) ::sut/object "http://example.org/notes/1"})))
(deftest Object-test (deftest Object-test
(is (s/valid? ::sut/Object (is (s/valid? ::sut/Object
{:summary "Sally liked a note", {::sut/summary "Sally liked a note",
:type "Like", ::sut/type "Like",
:actor {:type "Person", ::sut/actor {::sut/type "Person",
:name "Sally"}, ::sut/name "Sally"},
:object "http://example.org/notes/1"})) ::sut/object "http://example.org/notes/1"}))
(is (s/valid? ::sut/Object (is (s/valid? ::sut/Object
{:type "Object", {::sut/type "Object",
:id "http://www.test.example/object/1", ::sut/id "http://www.test.example/object/1",
:name "A Simple, non-specific object"}))) ::sut/name "A Simple, non-specific object"})))

Loading…
Cancel
Save