on the way to recursion

This commit is contained in:
Michael Jerger 2023-08-02 10:51:04 +02:00
parent d838ab5967
commit e44bdc2761
3 changed files with 12 additions and 4 deletions

View file

@ -17,4 +17,8 @@
is-functional-property? boolean?
"Checks whether spec is a FunctionalProperty."
[spec s/spec?]
(some #(clojure.string/includes? % "FunctionalProperty") (s/describe spec)))
(if ( s/get-spec spec)
(some
#(clojure.string/includes? % "FunctionalProperty")
(s/describe spec))
false))

View file

@ -3,14 +3,16 @@
[clojure.test :refer [deftest is are testing run-tests]]
[clojure.spec.alpha :as s]
[clojure.string :as str]
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as as]
[org.domaindrivenarchitecture.activity-pub-poc.core :as sut]))
(deftest should-serailize
(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\"}")
@ -18,6 +20,7 @@
{::as/id ["http://example.org/likes/1"]
::as/summary "Sally liked a note",
::as/type "Like",
::as/actor {::as/type "Person",
::as/actor {::as/id ["http://example.org/persons/1"]
::as/type "Person",
::as/name "Sally"},
::as/object "http://example.org/notes/1"}))))

View file

@ -8,4 +8,5 @@
(deftest shoult-test-spec-for-having-functional-property
(is (sut/is-functional-property? ::as2/id))
(is (not (sut/is-functional-property? ::as2/Like))))
(is (not (sut/is-functional-property? ::as2/Like)))
(is (not (sut/is-functional-property? ::as2/NotExisting))))