implement type
This commit is contained in:
parent
093fd24f77
commit
3dd9ff8ed0
2 changed files with 15 additions and 1 deletions
|
@ -88,7 +88,9 @@
|
||||||
;https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type
|
;https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type
|
||||||
;TODO: this can not be found in the ttl / namespace. Where is this exactly defined?
|
;TODO: this can not be found in the ttl / namespace. Where is this exactly defined?
|
||||||
(s/def ::type
|
(s/def ::type
|
||||||
::xsd/anyURI)
|
(s/or
|
||||||
|
:single-value ::xsd/anyURI
|
||||||
|
:coll-of-values (s/+ ::xsd/anyURI)))
|
||||||
|
|
||||||
;http://www.w3.org/ns/activitystreams#result
|
;http://www.w3.org/ns/activitystreams#result
|
||||||
(s/def ::result
|
(s/def ::result
|
||||||
|
|
|
@ -12,6 +12,18 @@
|
||||||
(is (not (s/valid? ::sut/id "https://no-uri:abc")))
|
(is (not (s/valid? ::sut/id "https://no-uri:abc")))
|
||||||
(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"]))))
|
||||||
|
|
||||||
|
|
||||||
|
(deftest type-test
|
||||||
|
(is (s/valid? ::sut/type "https://social.bla/alyssa/status/RANDOMHASH"))
|
||||||
|
(is (s/valid? ::sut/type "Activity"))
|
||||||
|
(is (s/valid? ::sut/type "Activity"))
|
||||||
|
(is (s/valid? ::sut/type ["https://social.bla/alyssa/status/RANDOMHASH", "https://social.bla/alyssa/status/RANDOMHASH2"]))
|
||||||
|
(is (not (s/valid? ::sut/type nil)))
|
||||||
|
(is (not (s/valid? ::sut/type [])))
|
||||||
|
(is (not (s/valid? ::sut/type 2)))
|
||||||
|
(is (not (s/valid? ::sut/type "https://no-uri:abc")))
|
||||||
|
)
|
||||||
|
|
||||||
(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 {:type "Note",
|
||||||
|
|
Loading…
Reference in a new issue