|
|
|
@ -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"})))
|
|
|
|
|