|
|
|
@ -6,22 +6,42 @@
|
|
|
|
|
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as as]
|
|
|
|
|
[org.domaindrivenarchitecture.activity-pub-poc.core :as sut]))
|
|
|
|
|
|
|
|
|
|
(def tmp )
|
|
|
|
|
|
|
|
|
|
(deftest should-normalize
|
|
|
|
|
(is (= {::as/id "http://example.org/likes/1"
|
|
|
|
|
::as/summary "Sally liked a note",
|
|
|
|
|
::as/type ["Like"],
|
|
|
|
|
::as/actor {::as/id "http://example.org/persons/1"
|
|
|
|
|
::as/type "Person",
|
|
|
|
|
::as/name "Sally"},
|
|
|
|
|
::as/object "http://example.org/notes/1"}
|
|
|
|
|
(sut/normalize
|
|
|
|
|
::as/Like
|
|
|
|
|
{::as/id ["http://example.org/likes/1"]
|
|
|
|
|
::as/summary "Sally liked a note",
|
|
|
|
|
::as/type ["Like"],
|
|
|
|
|
::as/actor {::as/id ["http://example.org/persons/1"]
|
|
|
|
|
::as/type "Person",
|
|
|
|
|
::as/name "Sally"},
|
|
|
|
|
::as/object "http://example.org/notes/1"}))))
|
|
|
|
|
|
|
|
|
|
(deftest should-serialize
|
|
|
|
|
(is (= (str "{\"@context\":\"https://www.w3.org/ns/activitystreams\","
|
|
|
|
|
"\"id\":\"http://example.org/likes/1\","
|
|
|
|
|
"\"summary\":\"Sally liked a note\","
|
|
|
|
|
"\"type\":\"Like\","
|
|
|
|
|
"\"actor\":{"
|
|
|
|
|
"\"id\":\"http://example.org/persons/1\","
|
|
|
|
|
"\"type\":\"Person\","
|
|
|
|
|
"\"name\":\"Sally\"},"
|
|
|
|
|
"\"object\":\"http://example.org/notes/1\"}")
|
|
|
|
|
(sut/serialize
|
|
|
|
|
::as/Like
|
|
|
|
|
{::as/id ["http://example.org/likes/1"]
|
|
|
|
|
::as/summary "Sally liked a note",
|
|
|
|
|
::as/type "Like",
|
|
|
|
|
::as/actor {::as/id ["http://example.org/persons/1"]
|
|
|
|
|
::as/type "Person",
|
|
|
|
|
::as/name "Sally"},
|
|
|
|
|
::as/object "http://example.org/notes/1"}))))
|
|
|
|
|
(is (= (str "{\"@context\":\"https://www.w3.org/ns/activitystreams\","
|
|
|
|
|
"\"id\":\"http://example.org/likes/1\","
|
|
|
|
|
"\"summary\":\"Sally liked a note\","
|
|
|
|
|
"\"type\":[\"Like\"],"
|
|
|
|
|
"\"actor\":{"
|
|
|
|
|
"\"id\":\"http://example.org/persons/1\","
|
|
|
|
|
"\"type\":\"Person\","
|
|
|
|
|
"\"name\":\"Sally\"},"
|
|
|
|
|
"\"object\":\"http://example.org/notes/1\"}")
|
|
|
|
|
(sut/serialize
|
|
|
|
|
::as/Like
|
|
|
|
|
{::as/id "http://example.org/likes/1"
|
|
|
|
|
::as/summary "Sally liked a note",
|
|
|
|
|
::as/type ["Like"],
|
|
|
|
|
::as/actor {::as/id "http://example.org/persons/1"
|
|
|
|
|
::as/type "Person",
|
|
|
|
|
::as/name "Sally"},
|
|
|
|
|
::as/object "http://example.org/notes/1"}))))
|