name the doseq-tests

This commit is contained in:
Tommi Reiman 2023-05-29 12:07:54 +03:00
parent b1404ada6d
commit 0728154751

View file

@ -606,7 +606,9 @@
{:request any? :response (clojure.spec.alpha/spec #{:end})}
{:request any? :response (clojure.spec.alpha/spec #{:default})}]]]
(testing (str coercion)
(doseq [app [(ring/ring-handler
(doseq [{:keys [name app]}
[{:name "using top-level :body"
:app (ring/ring-handler
(ring/router
["/foo" {:post {:request {:content {"application/json" {:schema json-request}
"application/edn" {:schema edn-request}}
@ -620,8 +622,9 @@
{:validate reitit.ring.spec/validate
:data {:middleware [rrc/coerce-request-middleware
rrc/coerce-response-middleware]
:coercion coercion}}))
(ring/ring-handler
:coercion coercion}}))}
{:name "using :default content"
:app (ring/ring-handler
(ring/router
["/foo" {:post {:request {:content {"application/json" {:schema json-request}
"application/edn" {:schema edn-request}
@ -637,7 +640,8 @@
{:validate reitit.ring.spec/validate
:data {:middleware [rrc/coerce-request-middleware
rrc/coerce-response-middleware]
:coercion coercion}}))]]
:coercion coercion}}))}]]
(testing name
(let [call (fn [request]
(try
(app request)
@ -669,7 +673,7 @@
(is (= {:type :reitit.coercion/response-coercion :in [:response :body]}
(call (request "application/json" "application/edn" {:request :json :response :json}))))
(is (= {:type :reitit.coercion/response-coercion :in [:response :body]}
(call (request "application/json" "application/transit" {:request :json :response :json}))))))))))
(call (request "application/json" "application/transit" {:request :json :response :json})))))))))))
#?(:clj