-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Very often I receive the dreaded:
expected: nil
actual: clojure.lang.ExceptionInfo: Couldn't satisfy such-that predicate after 10 tries.
at clojure.core$ex_info.invokeStatic (core.clj:4617)
clojure.core$ex_info.invoke (core.clj:4617)
Especially with this schema:
(defn lt
"Return a constrained schema that is valid iff (< (count %) size).
The schema parameter therefore needs to be Countable."
[schema size]
(s/constrained schema #(< (count %) size)))
(def NonEmptyStr (s/constrained s/Str #(not (empty? (str/trim %))) "non-empty string"))
(def UserId {:email (lt NonEmptyStr 40)})
I was checking and such-that
can increase the number of tries:
https://clojure.github.io/test.check/clojure.test.check.generators.html#var-such-that
Maybe we can have a dynamic var to pass in there?
PS: Is the above a good way to handle that case? I am still pretty new to schema
.
Metadata
Metadata
Assignees
Labels
No labels