diff options
Diffstat (limited to 'test/ruuter/core_test.cljc')
| -rw-r--r-- | test/ruuter/core_test.cljc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/ruuter/core_test.cljc b/test/ruuter/core_test.cljc index 9f1df23..75a71a0 100644 --- a/test/ruuter/core_test.cljc +++ b/test/ruuter/core_test.cljc @@ -4,7 +4,6 @@ #?(:cljs (:require [cljs.test :refer-macros [deftest testing is]] [ruuter.core :as ruuter]))) - (deftest path+uri->path-params-test (let [testfn #'ruuter/path+uri->path-params] (testing "No params returns an empty map" @@ -22,8 +21,16 @@ (testfn "/hello/:who/:why?" "/hello/world"))) (is (= {:who "world" :why "because"} - (testfn "/hello/:who/:why?" "/hello/world/because")))))) - + (testfn "/hello/:who/:why?" "/hello/world/because")))) + (testing "Multiple params, but all are optional" + (is (= {:who "world" + :why "because"} + (testfn "hello/:who?/:why?" "/hello/world/because"))) + (is (= {:who "world"} + (testfn "hello/:who?/:why?" "/hello/world")))) + (testing "Wildcard param" + (is (= {:everything* "this/means/literally/everything"} + (testfn "hello/:everything*" "/hello/this/means/literally/everything")))))) (deftest match-route-test (let [testfn #'ruuter/match-route] @@ -40,7 +47,6 @@ (is (= nil (testfn [] "/hello" :get)))))) - (deftest route+req->response-test (let [testfn #'ruuter/route+req->response] (testing "Returning a map when the response is a direct map" |
