changed :opt-un to :opt
This commit is contained in:
parent
1f076b9192
commit
686fe41dee
2 changed files with 43 additions and 43 deletions
|
@ -14,14 +14,14 @@
|
|||
(s/def ::Object
|
||||
(s/and
|
||||
::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
|
||||
;TODO: definition in progress
|
||||
(s/def ::Link
|
||||
(s/and
|
||||
::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
|
||||
;TODO: Define more properties necessary for Like
|
||||
|
@ -29,7 +29,7 @@
|
|||
(s/and
|
||||
::owl/Class
|
||||
::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
|
||||
;We only have this class, since the property "object" is in the domain "Activity" and "Relationship"
|
||||
|
@ -38,7 +38,7 @@
|
|||
(s/and
|
||||
::owl/Class
|
||||
::Object
|
||||
(sh/map-spec (s/keys :opt-un [::object]))))
|
||||
(sh/map-spec (s/keys :opt [::object]))))
|
||||
|
||||
;http://www.w3.org/ns/activitystreams#Like
|
||||
(s/def ::Like
|
||||
|
|
|
@ -25,36 +25,36 @@
|
|||
|
||||
(deftest object-test
|
||||
(is (s/valid? ::sut/object "http://example.org/posts/1"))
|
||||
(is (s/valid? ::sut/object {:type "Note",
|
||||
:content "A simple note"}))
|
||||
(is (s/valid? ::sut/object {::sut/type "Note",
|
||||
::sut/content "A simple note"}))
|
||||
(is (s/valid? ::sut/object ["http://example.org/posts/1",
|
||||
{:type "Note",
|
||||
:summary "A simple note",
|
||||
:content "That is a tree."}])))
|
||||
{::sut/type "Note",
|
||||
::sut/summary "A simple note",
|
||||
::sut/content "That is a tree."}])))
|
||||
|
||||
(deftest result-test
|
||||
(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 {:type "Link" :href "http://www.target.de"}))
|
||||
(is (s/valid? ::sut/result {::sut/type "http://www.types.example/flightstatus", ::sut/name "On Time"}))
|
||||
(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 47))))
|
||||
|
||||
|
||||
(deftest attachment-test
|
||||
(is (s/valid? ::sut/attachment
|
||||
[{:type "Image",
|
||||
:content "This is what he looks like.",
|
||||
:url "http://example.org/cat.jpeg"}])))
|
||||
[{::sut/type "Image",
|
||||
::sut/content "This is what he looks like.",
|
||||
::sut/url "http://example.org/cat.jpeg"}])))
|
||||
|
||||
(deftest actor-test
|
||||
(is (s/valid? ::sut/actor "http://sally.example.org"))
|
||||
(is (s/valid? ::sut/actor {:type "Person",
|
||||
:id "http://sally.example.org",
|
||||
:summary "Sally"}))
|
||||
(is (s/valid? ::sut/actor {::sut/type "Person",
|
||||
::sut/id "http://sally.example.org",
|
||||
::sut/summary "Sally"}))
|
||||
(is (s/valid? ::sut/actor ["http://joe.example.org",
|
||||
{:type "Person",
|
||||
:id "http://sally.example.org",
|
||||
:name "Sally"}])))
|
||||
{::sut/type "Person",
|
||||
::sut/id "http://sally.example.org",
|
||||
::sut/name "Sally"}])))
|
||||
|
||||
(deftest bcc-test
|
||||
(is (s/valid? ::sut/bcc ["http://joe.example.org"])))
|
||||
|
@ -70,34 +70,34 @@
|
|||
|
||||
(deftest Activity-test
|
||||
(is (s/valid? ::sut/Activity
|
||||
{:type "Activity",
|
||||
:summary "Sally did something to a note",
|
||||
:actor {:type "Person",
|
||||
:name "Sally"},
|
||||
:object {:type "Note",
|
||||
:name "A Note"}})))
|
||||
{::sut/type "Activity",
|
||||
::sut/summary "Sally did something to a note",
|
||||
::sut/actor {::sut/type "Person",
|
||||
::sut/name "Sally"},
|
||||
::sut/object {::sut/type "Note",
|
||||
::sut/name "A Note"}})))
|
||||
|
||||
(deftest Like-test
|
||||
(is (s/valid? ::sut/Like
|
||||
{:summary "Sally liked a note",
|
||||
:type "Like",
|
||||
:actor {:type "Person",
|
||||
:name "Sally"},
|
||||
:object "http://example.org/notes/1"}))
|
||||
{::sut/summary "Sally liked a note",
|
||||
::sut/type "Like",
|
||||
::sut/actor {::sut/type "Person",
|
||||
::sut/name "Sally"},
|
||||
::sut/object "http://example.org/notes/1"}))
|
||||
(is (s/valid? ::sut/Like
|
||||
{:id "foo",
|
||||
:type "Like",
|
||||
:actor "https://social.bla/alyssa",
|
||||
:object "http://example.org/notes/1"})))
|
||||
{::sut/id "foo",
|
||||
::sut/type "Like",
|
||||
::sut/actor "https://social.bla/alyssa",
|
||||
::sut/object "http://example.org/notes/1"})))
|
||||
|
||||
(deftest Object-test
|
||||
(is (s/valid? ::sut/Object
|
||||
{:summary "Sally liked a note",
|
||||
:type "Like",
|
||||
:actor {:type "Person",
|
||||
:name "Sally"},
|
||||
:object "http://example.org/notes/1"}))
|
||||
{::sut/summary "Sally liked a note",
|
||||
::sut/type "Like",
|
||||
::sut/actor {::sut/type "Person",
|
||||
::sut/name "Sally"},
|
||||
::sut/object "http://example.org/notes/1"}))
|
||||
(is (s/valid? ::sut/Object
|
||||
{:type "Object",
|
||||
:id "http://www.test.example/object/1",
|
||||
:name "A Simple, non-specific object"})))
|
||||
{::sut/type "Object",
|
||||
::sut/id "http://www.test.example/object/1",
|
||||
::sut/name "A Simple, non-specific object"})))
|
||||
|
|
Loading…
Reference in a new issue