From af7313bd9b68227ac839f6dc58c865d4eec49c04 Mon Sep 17 00:00:00 2001 From: Joel Kaasinen Date: Fri, 14 Nov 2025 14:05:36 +0200 Subject: [PATCH] test: add test for overriding malli registry --- test/cljc/reitit/ring_coercion_test.cljc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/cljc/reitit/ring_coercion_test.cljc b/test/cljc/reitit/ring_coercion_test.cljc index 14db797b..10fbb1f2 100644 --- a/test/cljc/reitit/ring_coercion_test.cljc +++ b/test/cljc/reitit/ring_coercion_test.cljc @@ -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 identity custom-meta-merge-checking-parameters))))) - (testing "options" + (testing "malli options" (let [->app (fn [options] (ring/ring-handler (ring/router @@ -593,7 +593,7 @@ [:i :int] [:x :string]]} :handler (fn [{{:keys [body]} :parameters}] - {:status 200 :body {}})}}] + {:status 200 :body body})}}] {:data {:middleware [rrc/coerce-exceptions-middleware rrc/coerce-request-middleware rrc/coerce-response-middleware] @@ -611,7 +611,12 @@ :malli.core/missing-key {:error/message {:en "MISSING"}}}}}) (assoc request :body-params {:i "x"})) :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 (deftest per-content-type-test