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]
|
(:require [clojure.spec.alpha :as s]
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[org.domaindrivenarchitecture.activity-pub-poc.spec-helper :as sh]
|
[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,19 +2,17 @@
|
||||||
(:require
|
(:require
|
||||||
[clojure.test :refer [deftest is are testing run-tests]]
|
[clojure.test :refer [deftest is are testing run-tests]]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
|
[clojure.string :as str]
|
||||||
[org.domaindrivenarchitecture.activity-pub-poc.core :as sut]))
|
[org.domaindrivenarchitecture.activity-pub-poc.core :as sut]))
|
||||||
|
|
||||||
(deftest should-serailize
|
(deftest should-serailize
|
||||||
(is (= "{
|
(is (= (str "{\"@context\": \"https://www.w3.org/ns/activitystreams\", "
|
||||||
\"@context\": \"https://www.w3.org/ns/activitystreams\",
|
"\"summary\": \"Sally liked a note\", "
|
||||||
\"summary\": \"Sally liked a note\",
|
"\"type\": \"Like\", "
|
||||||
\"type\": \"Like\",
|
"\"actor\": {"
|
||||||
\"actor\": {
|
"\"type\": \"Person\", "
|
||||||
\"type\": \"Person\",
|
"\"name\": \"Sally\"}, "
|
||||||
\"name\": \"Sally\"
|
"\"object\": \"http://example.org/notes/1\"}")
|
||||||
},
|
|
||||||
\"object\": \"http://example.org/notes/1\"
|
|
||||||
}"
|
|
||||||
(sut/serialize
|
(sut/serialize
|
||||||
{:summary "Sally liked a note",
|
{:summary "Sally liked a note",
|
||||||
:type "Like",
|
:type "Like",
|
||||||
|
|
Loading…
Reference in a new issue