mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 00:11:11 +00:00
The new ::spec/routes
This commit is contained in:
parent
3bc42a8de8
commit
4074d31a99
2 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue