Skip to content

Commit 07738e0

Browse files
committed
Add test for changing swagger-routes basePath
1 parent 3a9c4cf commit 07738e0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/compojure/api/swagger_test.clj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,18 @@
170170
:path-params [foo :- String]
171171
identity))
172172
=> {"/:foo.json" {:get {:parameters {:path {:foo String}}}}})
173+
174+
(facts
175+
(tabular
176+
(fact "swagger-routes basePath can be changed"
177+
(let [app (api (swagger-routes ?given-options))]
178+
(->
179+
(get* app "/swagger.json")
180+
(nth 1)
181+
:basePath)
182+
=> ?expected-base-path
183+
(nth (raw-get* app "/conf.js") 1) => (str "window.API_CONF = {\"url\":\"" ?expected-swagger-docs-path "\"};")))
184+
?given-options ?expected-swagger-docs-path ?expected-base-path
185+
{} "/swagger.json" "/"
186+
{:data {:basePath "/app"}} "/app/swagger.json" "/app"
187+
{:data {:basePath "/app"} :options {:ui {:swagger-docs "/imaginary.json"}}} "/imaginary.json" "/app"))

0 commit comments

Comments
 (0)