Routing -> Router, fix tests

This commit is contained in:
Tommi Reiman 2017-08-21 09:10:21 +03:00
parent f5f1104826
commit 9701a51c5a
2 changed files with 10 additions and 10 deletions

View file

@ -81,7 +81,7 @@
(defn compile-route [[p m :as route] {:keys [compile] :as opts}] (defn compile-route [[p m :as route] {:keys [compile] :as opts}]
[p m (if compile (compile route opts))]) [p m (if compile (compile route opts))])
(defprotocol Routing (defprotocol Router
(router-type [this]) (router-type [this])
(routes [this]) (routes [this])
(options [this]) (options [this])
@ -131,7 +131,7 @@
[[] {}] compiled) [[] {}] compiled)
lookup (impl/fast-map lookup)] lookup (impl/fast-map lookup)]
(reify (reify
Routing Router
(router-type [_] (router-type [_]
:linear-router) :linear-router)
(routes [_] (routes [_]
@ -175,7 +175,7 @@
lookup)]) [{} {}] compiled) lookup)]) [{} {}] compiled)
data (impl/fast-map data) data (impl/fast-map data)
lookup (impl/fast-map lookup)] lookup (impl/fast-map lookup)]
(reify Routing (reify Router
(router-type [_] (router-type [_]
:lookup-router) :lookup-router)
(routes [_] (routes [_]

View file

@ -1,8 +1,8 @@
(ns reitit.core-test (ns reitit.core-test
(:require [clojure.test :refer [deftest testing is are]] (:require [clojure.test :refer [deftest testing is are]]
[reitit.core :as reitit #?@(:cljs [:refer [Match Routing]])]) [reitit.core :as reitit #?@(:cljs [:refer [Match]])])
#?(:clj #?(:clj
(:import (reitit.core Match Routing) (:import (reitit.core Match)
(clojure.lang ExceptionInfo)))) (clojure.lang ExceptionInfo))))
(deftest reitit-test (deftest reitit-test
@ -181,9 +181,9 @@
(reitit/router (reitit/router
[["/a"] ["/a"]])))) [["/a"] ["/a"]]))))
(testing "can be configured to ignore" (testing "can be configured to ignore"
(is (instance? (is (not
Routing (nil?
(reitit/router (reitit/router
[["/a"] ["/a"]] [["/a"] ["/a"]]
{:conflicts (constantly nil)})))))) {:conflicts (constantly nil)})))))))