Compare commits
2 commits
077a50e733
...
8aea2c5326
Author | SHA1 | Date | |
---|---|---|---|
8aea2c5326 | |||
21c5a0244e |
4 changed files with 19 additions and 10 deletions
|
@ -5,11 +5,7 @@
|
||||||
[org.domaindrivenarchitecture.activity-pub-poc.owl :as owl]
|
[org.domaindrivenarchitecture.activity-pub-poc.owl :as owl]
|
||||||
[org.domaindrivenarchitecture.activity-pub-poc.xsd :as xsd]))
|
[org.domaindrivenarchitecture.activity-pub-poc.xsd :as xsd]))
|
||||||
|
|
||||||
(defn-spec
|
|
||||||
is-functional-property? boolean?
|
|
||||||
"Checks whether spec is a FunctionalProperty."
|
|
||||||
[spec keyword?]
|
|
||||||
(some #(clojure.string/includes? % "FunctionalProperty") (s/describe spec)))
|
|
||||||
|
|
||||||
;=======================
|
;=======================
|
||||||
|
|
||||||
|
|
|
@ -12,3 +12,9 @@
|
||||||
(s/or
|
(s/or
|
||||||
:no-map #(not (map? %))
|
:no-map #(not (map? %))
|
||||||
:map spec)))
|
:map spec)))
|
||||||
|
|
||||||
|
(defn-spec
|
||||||
|
is-functional-property? boolean?
|
||||||
|
"Checks whether spec is a FunctionalProperty."
|
||||||
|
[spec s/spec?]
|
||||||
|
(some #(clojure.string/includes? % "FunctionalProperty") (s/describe spec)))
|
|
@ -5,10 +5,6 @@
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as sut]))
|
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as sut]))
|
||||||
|
|
||||||
(deftest shoult-test-spec-for-having-functional-property
|
|
||||||
(is (sut/is-functional-property? ::sut/id))
|
|
||||||
(is (not (sut/is-functional-property? ::sut/Like))))
|
|
||||||
|
|
||||||
(deftest id-test
|
(deftest id-test
|
||||||
(is (s/valid? ::sut/id "https://social.bla/alyssa/status/RANDOMHASH"))
|
(is (s/valid? ::sut/id "https://social.bla/alyssa/status/RANDOMHASH"))
|
||||||
(is (not (s/valid? ::sut/id nil)))
|
(is (not (s/valid? ::sut/id nil)))
|
|
@ -0,0 +1,11 @@
|
||||||
|
(ns org.domaindrivenarchitecture.activity-pub-poc.spec-helper-test
|
||||||
|
(:require
|
||||||
|
[clojure.test :refer [deftest is are testing run-tests]]
|
||||||
|
[clojure.spec.test.alpha :as st]
|
||||||
|
[clojure.spec.alpha :as s]
|
||||||
|
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as as2]
|
||||||
|
[org.domaindrivenarchitecture.activity-pub-poc.spec-helper :as sut]))
|
||||||
|
|
||||||
|
(deftest shoult-test-spec-for-having-functional-property
|
||||||
|
(is (sut/is-functional-property? ::as2/id))
|
||||||
|
(is (not (sut/is-functional-property? ::as2/Like))))
|
Loading…
Reference in a new issue