Run history tests only on browser

This commit is contained in:
Juho Teperi 2018-07-11 09:52:45 +03:00
parent 245902bd4d
commit 06b641398a

View file

@ -3,7 +3,10 @@
[reitit.core :as r] [reitit.core :as r]
[reitit.frontend.history :as rfh])) [reitit.frontend.history :as rfh]))
(def browser (exists? js/window))
(deftest fragment-history-test (deftest fragment-history-test
(when browser
(let [router (r/router ["/" (let [router (r/router ["/"
["" ::frontpage] ["" ::frontpage]
["foo" ::foo] ["foo" ::foo]
@ -21,9 +24,10 @@
(is (= "#/bar/5?q=x" (is (= "#/bar/5?q=x"
(rfh/href history ::bar {:id 5} {:q "x"}))) (rfh/href history ::bar {:id 5} {:q "x"})))
(is (= nil (is (= nil
(rfh/href history ::asd)))))) (rfh/href history ::asd)))))))
(deftest html5-history-test (deftest html5-history-test
(when browser
(let [router (r/router ["/" (let [router (r/router ["/"
["" ::frontpage] ["" ::frontpage]
["foo" ::foo] ["foo" ::foo]
@ -41,4 +45,4 @@
(is (= "/bar/5?q=x" (is (= "/bar/5?q=x"
(rfh/href history ::bar {:id 5} {:q "x"}))) (rfh/href history ::bar {:id 5} {:q "x"})))
(is (= nil (is (= nil
(rfh/href history ::asd)))))) (rfh/href history ::asd)))))))