mirror of
https://github.com/metosin/reitit.git
synced 2025-12-22 18:41:10 +00:00
Fixes
This commit is contained in:
parent
1ba77a7267
commit
f60a7ad902
1 changed files with 13 additions and 8 deletions
|
|
@ -310,16 +310,21 @@
|
||||||
x))
|
x))
|
||||||
|
|
||||||
(deftest match->path-coercion-test
|
(deftest match->path-coercion-test
|
||||||
(testing "default Date toString"
|
(testing "default keyword to string"
|
||||||
(is (str/starts-with?
|
(is (str/starts-with?
|
||||||
(rf/match->path {:path "foo"} {:date (js/Date. 2024 0 1 12 13 0)})
|
(rf/match->path {:path "foo"} {:q :x})
|
||||||
"foo?date=Mon+Jan+01+2024+12")))
|
"foo?q=x")))
|
||||||
|
|
||||||
(is (= "foo?date=x2024-01-01T10%3A13%3A00.000Z"
|
(is (= "foo?q=__x"
|
||||||
(rf/match->path {:data {:coercion rcm/coercion
|
(rf/match->path {:data {:coercion rcm/coercion
|
||||||
:parameters {:query [[:map
|
:parameters {:query [[:map
|
||||||
[:date {:decode/string string->instant
|
[:q {:decode/string (fn [s]
|
||||||
:encode/string instant->string}
|
(if (string? s)
|
||||||
:any]]]}}
|
(keyword (if (str/starts-with? s "__")
|
||||||
|
(subs s 2)
|
||||||
|
s))
|
||||||
|
s))
|
||||||
|
:encode/string (fn [k] (str "__" (name k)))}
|
||||||
|
:keyword]]]}}
|
||||||
:path "foo"}
|
:path "foo"}
|
||||||
{:date (js/Date. 2024 0 1 12 13 0)}))))
|
{:q "x"}))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue