From d54c05426ccf089a81b2842675eb640ca66955ea Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Tue, 24 Jul 2018 11:45:51 +0300 Subject: [PATCH] Share router between history tests --- test/cljs/reitit/frontend/history_test.cljs | 24 +++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/test/cljs/reitit/frontend/history_test.cljs b/test/cljs/reitit/frontend/history_test.cljs index 3185b611..36eb8cf2 100644 --- a/test/cljs/reitit/frontend/history_test.cljs +++ b/test/cljs/reitit/frontend/history_test.cljs @@ -1,21 +1,20 @@ (ns reitit.frontend.history-test (:require [clojure.test :refer [deftest testing is are]] [reitit.core :as r] + [reitit.frontend :as rf] [reitit.frontend.history :as rfh] [reitit.frontend.test-utils :refer [capture-console]])) (def browser (exists? js/window)) +(def router (r/router ["/" + ["" ::frontpage] + ["foo" ::foo] + ["bar/:id" ::bar]])) + (deftest fragment-history-test (when browser - (let [router (r/router ["/" - ["" ::frontpage] - ["foo" ::foo] - ["bar/:id" ::bar]]) - history (rfh/start! router - (fn [_]) - {:use-fragment true - :path-prefix "/"})] + (let [history (rfh/start! router (fn [_]) {:use-fragment true})] (testing "creating urls" (is (= "#/foo" @@ -34,14 +33,7 @@ (deftest html5-history-test (when browser - (let [router (r/router ["/" - ["" ::frontpage] - ["foo" ::foo] - ["bar/:id" ::bar]]) - history (rfh/start! router - (fn [_]) - {:use-fragment false - :path-prefix "/"})] + (let [history (rfh/start! router (fn [_]) {:use-fragment false})] (testing "creating urls" (is (= "/foo"