                        (gobject/getKeys props))))))
 
 (defn morph-data [component spec]
-  (->> (gen/sample-seq (s/gen spec))
-       (take 100)
-       (group-by (comp signature component))
-       (sort-by (comp hash key))
-       vals
-       (map first)))
+  (let [sample-size 100
+        groups (->> (gen/sample-seq (s/gen spec))
+                    (take sample-size)
+                    (group-by (comp signature component)))]
+    (when (> sample-size (count groups))
+      (->> groups
+           (sort-by (comp hash key))
+           vals
+           (map first)))))
 
 
-
-(s/def ::data-for-component
-  (s/keys :req [::type ::description]))
-
-(s/def ::type #{:type-a :type-b})
-
-(s/def ::description (s/and string? seq))
-
-(defn component [props]
-  (html
-   [:div {:class (name (::type props))}
-    [:.description
-     (when (< 2 (count (::description props))) {:class "long"})
-     (::description props)]]))
 
 (deftest signature-test
   (is (= {:type "div"

                           [:span {:class "baz" :title "qux"}
                            "Some text."]])))))

(deftest morph-data-test
  (dotimes [_ 10]
    (let [data (morph-data component ::data-for-component)]
      (is (every? (partial s/valid? ::data-for-component) data))
      (is (= 4 (count data)))
      (is (= 2 (count (group-by ::type data)))))))

(defcard demo
  (html

(ns frontend.test-gencard
  (:require [cljs.test :refer-macros [is testing]]
            [clojure.spec :as s :include-macros true]
            [clojure.test.check.generators :as gen]
            [goog.object :as gobject])
