The new ::spec/routes

This commit is contained in:
Tommi Reiman 2017-09-08 08:29:31 +03:00
parent 3bc42a8de8
commit 4074d31a99
2 changed files with 6 additions and 2 deletions

View file

@ -26,7 +26,8 @@
(s/def ::route (s/def ::route
(s/cat :path ::path (s/cat :path ::path
:meta ::meta)) :meta ::meta
:result (s/? any?)))
(s/def ::routes (s/def ::routes
(s/or :route ::route (s/or :route ::route

View file

@ -7,7 +7,7 @@
#?(:clj #?(:clj
(:import (clojure.lang ExceptionInfo)))) (:import (clojure.lang ExceptionInfo))))
(stest/instrument `reitit/router) (stest/instrument `reitit/router `reitit/routes)
(deftest router-spec-test (deftest router-spec-test
@ -44,6 +44,9 @@
["/api" [] ["/api" []
["/ipa"]]))) ["/ipa"]])))
(testing "routes conform to spec (can't spec protocol functions)"
(is (= true (s/valid? ::spec/routes (reitit/routes (reitit/router ["/ping"]))))))
(testing "options" (testing "options"
(are [opts] (are [opts]