mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 16:31:11 +00:00
cleanup
This commit is contained in:
parent
550ea6da58
commit
3f265888a4
4 changed files with 138 additions and 139 deletions
|
|
@ -267,14 +267,14 @@
|
|||
(let [pong (constantly "ok")
|
||||
routes ["/api" {:mw [:api]}
|
||||
["/ping" :kikka]
|
||||
["/user/:id" {:parameters {:id "String"}}
|
||||
["/:sub-id" {:parameters {:sub-id "String"}}]]
|
||||
["/user/:id" {:parameters {:path {:id :string}}}
|
||||
["/:sub-id" {:parameters {:path {:sub-id :string}}}]]
|
||||
["/pong" pong]
|
||||
["/admin" {:mw [:admin] :roles #{:admin}}
|
||||
["/user" {:roles ^:replace #{:user}}]
|
||||
["/db" {:mw [:db]}]]]
|
||||
expected [["/api/ping" {:mw [:api], :name :kikka}]
|
||||
["/api/user/:id/:sub-id" {:mw [:api], :parameters {:id "String", :sub-id "String"}}]
|
||||
["/api/user/:id/:sub-id" {:mw [:api], :parameters {:path [{:id :string} {:sub-id :string}]}}]
|
||||
["/api/pong" {:mw [:api], :handler pong}]
|
||||
["/api/admin/user" {:mw [:api :admin], :roles #{:user}}]
|
||||
["/api/admin/db" {:mw [:api :admin :db], :roles #{:admin}}]]
|
||||
|
|
@ -282,7 +282,7 @@
|
|||
(is (= expected (impl/resolve-routes routes (r/default-router-options))))
|
||||
(is (= (r/map->Match
|
||||
{:template "/api/user/:id/:sub-id"
|
||||
:data {:mw [:api], :parameters {:id "String", :sub-id "String"}}
|
||||
:data {:mw [:api], :parameters {:path [{:id :string} {:sub-id :string}]}}
|
||||
:path "/api/user/1/2"
|
||||
:path-params {:id "1", :sub-id "2"}})
|
||||
(r/match-by-path router "/api/user/1/2"))))))
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@
|
|||
{:description (str "description " nom)})})]
|
||||
[#'spec/coercion (fn [nom] {nom (st/spec {:spec string?
|
||||
:description (str "description " nom)})})]]]
|
||||
(testing coercion
|
||||
(testing (str coercion)
|
||||
(let [app (ring/ring-handler
|
||||
(ring/router
|
||||
[["/parameters"
|
||||
|
|
@ -451,7 +451,7 @@
|
|||
(assoc
|
||||
(ds/spec ::foo {nom (st/spec string? {:openapi/example "EXAMPLE"})})
|
||||
:openapi/example {nom "EXAMPLE2"}))]]]
|
||||
(testing coercion
|
||||
(testing (str coercion)
|
||||
(let [app (ring/ring-handler
|
||||
(ring/router
|
||||
[["/examples"
|
||||
|
|
@ -531,7 +531,7 @@
|
|||
[#'spec/coercion
|
||||
reitit.http.interceptors.multipart/bytes-part
|
||||
string?]]]
|
||||
(testing coercion
|
||||
(testing (str coercion)
|
||||
(let [app (ring/ring-handler
|
||||
(ring/router
|
||||
[["/upload"
|
||||
|
|
@ -569,7 +569,7 @@
|
|||
[[#'malli/coercion (fn [nom] [:map [nom :string]])]
|
||||
[#'schema/coercion (fn [nom] {nom s/Str})]
|
||||
[#'spec/coercion (fn [nom] {nom string?})]]]
|
||||
(testing coercion
|
||||
(testing (str coercion)
|
||||
(let [app (ring/ring-handler
|
||||
(ring/router
|
||||
[["/parameters"
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@
|
|||
rrc/coerce-request-middleware
|
||||
rrc/coerce-response-middleware]}})))
|
||||
|
||||
(require '[fipp.edn])
|
||||
(deftest swagger-test
|
||||
(testing "endpoints work"
|
||||
(testing "spec"
|
||||
|
|
@ -430,7 +429,7 @@
|
|||
[#'spec/coercion
|
||||
reitit.http.interceptors.multipart/bytes-part
|
||||
string?]]]
|
||||
(testing coercion
|
||||
(testing (str coercion)
|
||||
(let [app (ring/ring-handler
|
||||
(ring/router
|
||||
[["/upload"
|
||||
|
|
|
|||
Loading…
Reference in a new issue