test: add test for overriding malli registry

This commit is contained in:
Joel Kaasinen 2025-11-14 14:05:36 +02:00
parent ea58100fec
commit af7313bd9b
No known key found for this signature in database

View file

@ -585,7 +585,7 @@
(is (= {:status 200, :body {:total "FOO: this, BAR: that"}} (call m/schema custom-meta-merge-checking-schema))) (is (= {:status 200, :body {:total "FOO: this, BAR: that"}} (call m/schema custom-meta-merge-checking-schema)))
(is (= {:status 200, :body {:total "FOO: this, BAR: that"}} (call identity custom-meta-merge-checking-parameters))))) (is (= {:status 200, :body {:total "FOO: this, BAR: that"}} (call identity custom-meta-merge-checking-parameters)))))
(testing "options" (testing "malli options"
(let [->app (fn [options] (let [->app (fn [options]
(ring/ring-handler (ring/ring-handler
(ring/router (ring/router
@ -593,7 +593,7 @@
[:i :int] [:i :int]
[:x :string]]} [:x :string]]}
:handler (fn [{{:keys [body]} :parameters}] :handler (fn [{{:keys [body]} :parameters}]
{:status 200 :body {}})}}] {:status 200 :body body})}}]
{:data {:middleware [rrc/coerce-exceptions-middleware {:data {:middleware [rrc/coerce-exceptions-middleware
rrc/coerce-request-middleware rrc/coerce-request-middleware
rrc/coerce-response-middleware] rrc/coerce-response-middleware]
@ -611,7 +611,12 @@
:malli.core/missing-key {:error/message {:en "MISSING"}}}}}) :malli.core/missing-key {:error/message {:en "MISSING"}}}}})
(assoc request :body-params {:i "x"})) (assoc request :body-params {:i "x"}))
:body :body
:humanized)))))))) :humanized))))
(testing "overriding registry"
(is (= {:body {:i "x" :x "x"} :status 200}
(-> ((->app {:options {:registry (merge (m/default-schemas)
{:int :string})}})
(assoc request :body-params {:i "x" :x "x"}))))))))))
#?(:clj #?(:clj
(deftest per-content-type-test (deftest per-content-type-test