File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 145
145
(gen/one-of gs)))
146
146
147
147
(defn- -seqable-gen [schema options]
148
- (let [el (-> schema m/children first)]
148
+ (let [{:keys [min]} (-min-max schema options)
149
+ el (-> schema m/children first)]
149
150
(gen-one-of
150
- (-> [nil-gen]
151
+ (-> []
152
+ (cond->
153
+ (or (nil? min) (zero? min))
154
+ (conj nil-gen))
151
155
(into (map #(-coll-gen schema % options))
152
156
[identity vec eduction #(into-array #?(:clj Object) %)])
153
157
(conj (-coll-distinct-gen schema set options))
Original file line number Diff line number Diff line change 1137
1137
[{} :map ]]]
1138
1138
(is (every? #{{:type nil } {:type {}}} (mg/sample schema)))
1139
1139
(is (every? (m/validator schema) (mg/sample schema))))))
1140
+
1141
+ (deftest seqable-generates-non-empty-with-positive-min-test
1142
+ (is (seq (mg/generate [:seqable {:min 4 :max 4 } :int ] {:seed 0 })))
1143
+ (doseq [_ (range 100 )
1144
+ v (mg/sample [:seqable {:min 1 } :any ])]
1145
+ (is (seq v))))
You can’t perform that action at this time.
0 commit comments