From e44bdc2761488c253effcd787ee28d4add6c1285 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Wed, 2 Aug 2023 10:51:04 +0200 Subject: [PATCH] on the way to recursion --- .../activity_pub_poc/spec_helper.cljc | 6 +++++- .../activity_pub_poc/core_test.cljc | 7 +++++-- .../activity_pub_poc/spec_helper_test.cljc | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper.cljc index cada86f..c4393fa 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper.cljc @@ -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))) \ No newline at end of file + (if ( s/get-spec spec) + (some + #(clojure.string/includes? % "FunctionalProperty") + (s/describe spec)) + false)) \ No newline at end of file diff --git a/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/core_test.cljc b/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/core_test.cljc index 2bbc8b6..78498a9 100644 --- a/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/core_test.cljc +++ b/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/core_test.cljc @@ -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"})))) \ No newline at end of file diff --git a/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper_test.cljc b/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper_test.cljc index cb7f08a..6d572e7 100644 --- a/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper_test.cljc +++ b/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/spec_helper_test.cljc @@ -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)))) \ No newline at end of file + (is (not (sut/is-functional-property? ::as2/Like))) + (is (not (sut/is-functional-property? ::as2/NotExisting)))) \ No newline at end of file