mirror of
https://github.com/metosin/reitit.git
synced 2026-02-24 02:32:22 +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 #{:end})}
|
||||||
{:request any? :response (clojure.spec.alpha/spec #{:default})}]]]
|
{:request any? :response (clojure.spec.alpha/spec #{:default})}]]]
|
||||||
(testing (str coercion)
|
(testing (str coercion)
|
||||||
(doseq [app [(ring/ring-handler
|
(doseq [{:keys [name app]}
|
||||||
|
[{:name "using top-level :body"
|
||||||
|
:app (ring/ring-handler
|
||||||
(ring/router
|
(ring/router
|
||||||
["/foo" {:post {:request {:content {"application/json" {:schema json-request}
|
["/foo" {:post {:request {:content {"application/json" {:schema json-request}
|
||||||
"application/edn" {:schema edn-request}}
|
"application/edn" {:schema edn-request}}
|
||||||
|
|
@ -620,8 +622,9 @@
|
||||||
{:validate reitit.ring.spec/validate
|
{:validate reitit.ring.spec/validate
|
||||||
:data {:middleware [rrc/coerce-request-middleware
|
:data {:middleware [rrc/coerce-request-middleware
|
||||||
rrc/coerce-response-middleware]
|
rrc/coerce-response-middleware]
|
||||||
:coercion coercion}}))
|
:coercion coercion}}))}
|
||||||
(ring/ring-handler
|
{:name "using :default content"
|
||||||
|
:app (ring/ring-handler
|
||||||
(ring/router
|
(ring/router
|
||||||
["/foo" {:post {:request {:content {"application/json" {:schema json-request}
|
["/foo" {:post {:request {:content {"application/json" {:schema json-request}
|
||||||
"application/edn" {:schema edn-request}
|
"application/edn" {:schema edn-request}
|
||||||
|
|
@ -637,7 +640,8 @@
|
||||||
{:validate reitit.ring.spec/validate
|
{:validate reitit.ring.spec/validate
|
||||||
:data {:middleware [rrc/coerce-request-middleware
|
:data {:middleware [rrc/coerce-request-middleware
|
||||||
rrc/coerce-response-middleware]
|
rrc/coerce-response-middleware]
|
||||||
:coercion coercion}}))]]
|
:coercion coercion}}))}]]
|
||||||
|
(testing name
|
||||||
(let [call (fn [request]
|
(let [call (fn [request]
|
||||||
(try
|
(try
|
||||||
(app request)
|
(app request)
|
||||||
|
|
@ -669,7 +673,7 @@
|
||||||
(is (= {:type :reitit.coercion/response-coercion :in [:response :body]}
|
(is (= {:type :reitit.coercion/response-coercion :in [:response :body]}
|
||||||
(call (request "application/json" "application/edn" {:request :json :response :json}))))
|
(call (request "application/json" "application/edn" {:request :json :response :json}))))
|
||||||
(is (= {:type :reitit.coercion/response-coercion :in [:response :body]}
|
(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
|
#?(:clj
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue