mirror of
https://github.com/metosin/reitit.git
synced 2026-02-26 10:52:23 +00:00
name the doseq-tests
This commit is contained in:
parent
b1404ada6d
commit
0728154751
1 changed files with 68 additions and 64 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue