From f60a7ad9028999c56d170c591db335466e46b0fb Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Wed, 22 Jan 2025 11:14:35 +0200 Subject: [PATCH] Fixes --- test/cljs/reitit/frontend/core_test.cljs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/cljs/reitit/frontend/core_test.cljs b/test/cljs/reitit/frontend/core_test.cljs index 9bb054ba..559da199 100644 --- a/test/cljs/reitit/frontend/core_test.cljs +++ b/test/cljs/reitit/frontend/core_test.cljs @@ -310,16 +310,21 @@ x)) (deftest match->path-coercion-test - (testing "default Date toString" + (testing "default keyword to string" (is (str/starts-with? - (rf/match->path {:path "foo"} {:date (js/Date. 2024 0 1 12 13 0)}) - "foo?date=Mon+Jan+01+2024+12"))) + (rf/match->path {:path "foo"} {:q :x}) + "foo?q=x"))) - (is (= "foo?date=x2024-01-01T10%3A13%3A00.000Z" + (is (= "foo?q=__x" (rf/match->path {:data {:coercion rcm/coercion :parameters {:query [[:map - [:date {:decode/string string->instant - :encode/string instant->string} - :any]]]}} + [:q {:decode/string (fn [s] + (if (string? s) + (keyword (if (str/starts-with? s "__") + (subs s 2) + s)) + s)) + :encode/string (fn [k] (str "__" (name k)))} + :keyword]]]}} :path "foo"} - {:date (js/Date. 2024 0 1 12 13 0)})))) + {:q "x"}))))