This commit is contained in:
Tommi Reiman 2023-05-27 19:02:10 +03:00
parent d17c97780e
commit 1b5287724e

View file

@ -517,20 +517,19 @@
(is (nil? (validate spec)))))))) (is (nil? (validate spec))))))))
(deftest multipart-test (deftest multipart-test
(doseq [[coercion file-schema string-schema] (doseq [[coercion file-schema string-schema] [[#'malli/coercion
[[#'malli/coercion reitit.ring.malli/bytes-part
reitit.ring.malli/bytes-part :string]
:string] [#'schema/coercion
[#'schema/coercion (schema-tools.core/schema {:filename s/Str
(schema-tools.core/schema {:filename s/Str :content-type s/Str
:content-type s/Str :bytes s/Num}
:bytes s/Num} {:openapi {:type "string"
{:openapi {:type "string" :format "binary"}})
:format "binary"}}) s/Str]
s/Str] [#'spec/coercion
[#'spec/coercion reitit.http.interceptors.multipart/bytes-part
reitit.http.interceptors.multipart/bytes-part string?]]]
string?]]]
(testing (str coercion) (testing (str coercion)
(let [app (ring/ring-handler (let [app (ring/ring-handler
(ring/router (ring/router
@ -565,10 +564,9 @@
(is (nil? (validate spec)))))))) (is (nil? (validate spec))))))))
(deftest per-content-type-test (deftest per-content-type-test
(doseq [[coercion ->schema] (doseq [[coercion ->schema] [[malli/coercion (fn [nom] [:map [nom :string]])]
[[malli/coercion (fn [nom] [:map [nom :string]])] [schema/coercion (fn [nom] {nom s/Str})]
[schema/coercion (fn [nom] {nom s/Str})] [spec/coercion (fn [nom] {nom string?})]]]
[spec/coercion (fn [nom] {nom string?})]]]
(testing (str coercion) (testing (str coercion)
(let [app (ring/ring-handler (let [app (ring/ring-handler
(ring/router (ring/router
@ -654,10 +652,9 @@
(is (nil? (validate spec)))))))) (is (nil? (validate spec))))))))
(deftest default-content-type-test (deftest default-content-type-test
(doseq [[coercion ->schema] (doseq [[coercion ->schema] [[malli/coercion (fn [nom] [:map [nom :string]])]
[[malli/coercion (fn [nom] [:map [nom :string]])] [schema/coercion (fn [nom] {nom s/Str})]
[schema/coercion (fn [nom] {nom s/Str})] [spec/coercion (fn [nom] {nom string?})]]]
[spec/coercion (fn [nom] {nom string?})]]]
(testing (str coercion) (testing (str coercion)
(doseq [content-type ["application/json" "application/edn"]] (doseq [content-type ["application/json" "application/edn"]]
(testing (str "default content type " content-type) (testing (str "default content type " content-type)