Add test to validate middleware cannot be list

When meta-merges list with a vector, the resulting order is reversed. To avoid
this for the middleware chain, middleware cannot be lists.
This commit is contained in:
Daw-Ran Liou 2019-10-09 07:55:59 -07:00 committed by Tommi Reiman
parent eeeba281ac
commit 4a199b918a

View file

@ -77,7 +77,15 @@
:data {:middleware [{:spec (s/keys :opt-un [::roles])
:wrap (fn [handler]
(fn [request]
(handler request)))}]}})))))
(handler request)))}]}}))))
(testing "middleware cannot be a list"
(is (thrown-with-msg?
ExceptionInfo
#":reitit.ring.spec/invalid-specs"
(ring/router
["/api" {:handler identity
:middleware '()}]
{:validate rrs/validate})))))
(deftest coercion-spec-test
(is (r/router?