more tests and investigation

pull/1/head
Michael Jerger 10 months ago
parent d4422ad19e
commit 06a1864b2f

@ -17,6 +17,14 @@
::owl/DeprecatedProperty
::xsd/anyURI))
;http://www.w3.org/ns/activitystreams#result
(s/def ::result
(s/and
::owl/ObjectProperty
::Class
::Object
::Link))
;http://www.w3.org/ns/activitystreams#attachment
(s/def ::attachment
(s/and
@ -25,34 +33,40 @@
::Link
::Object))
;http://www.w3.org/ns/activitystreams#result
(s/def ::result
(s/and
::owl/ObjectProperty
::Class
::Object
::Link))
;http://www.w3.org/ns/activitystreams#Relationship
;TODO: definition in progress
(s/def ::Relationship
(s/and (s/keys :opt-un [::object])))
;http://www.w3.org/ns/activitystreams#Activity
;TODO: definition in progress
(s/def ::Activity
(s/and ::Object
(s/keys :opt-un [::result])))
(s/keys :opt-un [::result
::object])))
;http://www.w3.org/ns/activitystreams#Object
;TODO: definition in progress
(s/def ::Object (s/keys :opt-un [::id ::attachment]))
;http://www.w3.org/ns/activitystreams#object
(s/def ::object
(s/and
::owl/ObjectProperty
::Class
(s/or ::Object
::Link)))
;http://www.w3.org/ns/activitystreams#object
(s/def ::Object
(s/keys :opt-un [::id ::Class]))
;http://www.w3.org/ns/activitystreams#Link
;TODO: definition in progress
(s/def ::Link (s/keys :opt-un [::id]))
;TODO: There is no as:Class! Why do we need this?
;Answer jem: I do not want to enhance owl/Class inline from here.
(s/def
::Class
(s/merge ::owl/Class
(s/keys :opt-un [::id])))
(s/keys :opt-un [::id ::object])))
;http://www.w3.org/ns/activitystreams#Like

@ -14,16 +14,27 @@
(is (not (s/valid? ::sut/id nil)))
(is (not (s/valid? ::sut/id 2)))
(is (not (s/valid? ::sut/id "no-uri")))
(is (not (s/valid? ::sut/id ["https://social.bla/alyssa/status/RANDOMHASH", "https://social.bla/alyssa/status/RANDOMHASH2"])))
)
(is (not (s/valid? ::sut/id ["https://social.bla/alyssa/status/RANDOMHASH", "https://social.bla/alyssa/status/RANDOMHASH2"]))))
;TODO: where does the ability for a link reference come from ?
(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 ["http://example.org/posts/1",
{:type "Note",
:summary "A simple note",
:content "That is a tree."}])))
(deftest class-test
(is (s/valid? ::sut/Class "https://social.bla/alyssa/status/RANDOMHASH")))
(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 (not (s/valid? ::sut/result nil)))
(is (not (s/valid? ::sut/result 47)))
)
(is (not (s/valid? ::sut/result 47))))
;(deftest attachment-test

Loading…
Cancel
Save