Added serialize and yet failing test
This commit is contained in:
parent
0e00da5c9a
commit
3eff9a628e
2 changed files with 24 additions and 17 deletions
|
@ -2,4 +2,13 @@
|
|||
(:require [clojure.spec.alpha :as s]
|
||||
[orchestra.core :refer [defn-spec]]
|
||||
[org.domaindrivenarchitecture.activity-pub-poc.spec-helper :as sh]
|
||||
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as as]))
|
||||
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as as]
|
||||
[clojure.data.json :as json]))
|
||||
|
||||
(defn serialize
|
||||
[as-map]
|
||||
(json/write-str
|
||||
(assoc
|
||||
as-map
|
||||
(keyword "@context")
|
||||
"https://www.w3.org/ns/activitystreams")))
|
|
@ -2,22 +2,20 @@
|
|||
(:require
|
||||
[clojure.test :refer [deftest is are testing run-tests]]
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.string :as str]
|
||||
[org.domaindrivenarchitecture.activity-pub-poc.core :as sut]))
|
||||
|
||||
(deftest should-serailize
|
||||
(is (= "{
|
||||
\"@context\": \"https://www.w3.org/ns/activitystreams\",
|
||||
\"summary\": \"Sally liked a note\",
|
||||
\"type\": \"Like\",
|
||||
\"actor\": {
|
||||
\"type\": \"Person\",
|
||||
\"name\": \"Sally\"
|
||||
},
|
||||
\"object\": \"http://example.org/notes/1\"
|
||||
}"
|
||||
(sut/serialize
|
||||
{:summary "Sally liked a note",
|
||||
:type "Like",
|
||||
:actor {:type "Person",
|
||||
:name "Sally"},
|
||||
:object "http://example.org/notes/1"}))))
|
||||
(is (= (str "{\"@context\": \"https://www.w3.org/ns/activitystreams\", "
|
||||
"\"summary\": \"Sally liked a note\", "
|
||||
"\"type\": \"Like\", "
|
||||
"\"actor\": {"
|
||||
"\"type\": \"Person\", "
|
||||
"\"name\": \"Sally\"}, "
|
||||
"\"object\": \"http://example.org/notes/1\"}")
|
||||
(sut/serialize
|
||||
{:summary "Sally liked a note",
|
||||
:type "Like",
|
||||
:actor {:type "Person",
|
||||
:name "Sally"},
|
||||
:object "http://example.org/notes/1"}))))
|
Loading…
Reference in a new issue