From 9e8abbf26d4422ba133bba7186363bee5b1f38d7 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Wed, 5 Oct 2022 22:29:03 +0300 Subject: 1.3.0 --- test/ruuter/core_test.cljc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'test') 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" -- cgit v1.2.3