Skip to content

Commit

Permalink
add another test case from slack report
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchy64 committed Jul 16, 2024
1 parent c089835 commit e0d64ae
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/malli/registry_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
[malli.registry :as mr]))

(deftest mutable-test
(let [registry* (atom {})
(let [registry* (atom (m/default-schemas))
registry (mr/mutable-registry registry*)
register! (fn [t ?s] (swap! registry* assoc t ?s))]
(testing "default registy"
(is (thrown? #?(:clj Exception, :cljs js/Error) (m/validate :str "kikka" {:registry registry})))
(register! :str (m/-string-schema))
(is (true? (m/validate :str "kikka" {:registry registry}))))))
(is (true? (m/validate :str "kikka" {:registry registry}))))
(register! ::int-pair (m/schema [:tuple :int :int]))
(is (thrown-with-msg?
#?(:clj Exception, :cljs js/Error)
#?(:clj #":malli\.core/infinitely-expanding-schema"
:cljs #":malli\.core/invalid-schema")
(m/schema [::int-pair {:foo :bar}] {:registry registry})))))

(deftest composite-test
(let [registry* (atom {})
Expand Down

0 comments on commit e0d64ae

Please sign in to comment.