mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 08:21:11 +00:00
Merge pull request #664 from metosin/fix-swagger-tests
Fix: swagger tests and CI
This commit is contained in:
commit
98f3eb0a72
3 changed files with 14 additions and 9 deletions
3
.github/workflows/testsuite.yml
vendored
3
.github/workflows/testsuite.yml
vendored
|
|
@ -32,6 +32,9 @@ jobs:
|
||||||
uses: DeLaGuardo/setup-clojure@3.1
|
uses: DeLaGuardo/setup-clojure@3.1
|
||||||
with:
|
with:
|
||||||
lein: 2.9.5
|
lein: 2.9.5
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
npm ci
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: ./scripts/test.sh clj
|
run: ./scripts/test.sh clj
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -652,12 +652,14 @@
|
||||||
:uri "/foo"
|
:uri "/foo"
|
||||||
:muuntaja/request {:format request-format}
|
:muuntaja/request {:format request-format}
|
||||||
:muuntaja/response {:format response-format}
|
:muuntaja/response {:format response-format}
|
||||||
:body-params body})]
|
:body-params body})
|
||||||
|
normalize-json (fn[body]
|
||||||
|
(-> body j/write-value-as-string (j/read-value j/keyword-keys-object-mapper)))]
|
||||||
(testing "succesful call"
|
(testing "succesful call"
|
||||||
(is (= {:status 200 :body {:request :json, :response :json}}
|
(is (= {:status 200 :body {:request "json", :response "json"}}
|
||||||
(call (request "application/json" "application/json" {:request :json :response :json}))))
|
(normalize-json (call (request "application/json" "application/json" {:request :json :response :json})))))
|
||||||
(is (= {:status 200 :body {:request :edn, :response :json}}
|
(is (= {:status 200 :body {:request "edn", :response "json"}}
|
||||||
(call (request "application/edn" "application/json" {:request :edn :response :json}))))
|
(normalize-json (call (request "application/edn" "application/json" {:request :edn :response :json})))))
|
||||||
(is (= {:status 200 :body {:request :default, :response :default}}
|
(is (= {:status 200 :body {:request :default, :response :default}}
|
||||||
(call (request "application/transit" "application/transit" {:request :default :response :default})))))
|
(call (request "application/transit" "application/transit" {:request :default :response :default})))))
|
||||||
(testing "request validation fails"
|
(testing "request validation fails"
|
||||||
|
|
|
||||||
|
|
@ -161,14 +161,14 @@
|
||||||
expected {:x-id #{::math}
|
expected {:x-id #{::math}
|
||||||
:swagger "2.0"
|
:swagger "2.0"
|
||||||
:info {:title "my-api"}
|
:info {:title "my-api"}
|
||||||
:definitions {::req-key {:type "string"
|
:definitions {"reitit.swagger-test/req-key" {:type "string"
|
||||||
:x-anyOf [{:type "string"}
|
:x-anyOf [{:type "string"}
|
||||||
{:type "string"}]}
|
{:type "string"}]}
|
||||||
::req-val {:type "object"
|
"reitit.swagger-test/req-val" {:type "object"
|
||||||
:x-anyOf [{:type "object"}
|
:x-anyOf [{:type "object"}
|
||||||
{:type "string"}]}
|
{:type "string"}]}
|
||||||
::resp-map {:type "object"},
|
"reitit.swagger-test/resp-map" {:type "object"},
|
||||||
::resp-string {:type "string"
|
"reitit.swagger-test/resp-string" {:type "string"
|
||||||
:minLength 1}}
|
:minLength 1}}
|
||||||
:paths {"/api/spec/plus/{z}" {:patch {:parameters []
|
:paths {"/api/spec/plus/{z}" {:patch {:parameters []
|
||||||
:summary "patch"
|
:summary "patch"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue