@@ -68,23 +68,22 @@
|
||||
(assert-eq "HTTP status" 200 (:status (get* base-url)))
|
||||
(println)
|
||||
|
||||
(println "Test 2: Content-Type is text/plain")
|
||||
(assert-contains "Content-Type" "text/plain" (get (:headers (get* base-url)) "content-type" ""))
|
||||
(println "Test 2: Content-Type is text/html")
|
||||
(assert-contains "Content-Type" "text/html" (get (:headers (get* base-url)) "content-type" ""))
|
||||
(println)
|
||||
|
||||
(println "Test 3: Root response points at the API docs")
|
||||
(println "Test 3: Root serves the HTML shell for the UI")
|
||||
(let [body (:body (get* base-url))]
|
||||
(assert-contains "Body mentions /api-docs" "/api-docs" body)
|
||||
(assert-not-empty "Body is non-empty" body)
|
||||
(println)
|
||||
(assert-contains "Body has the mount point" "<div id=\"app\"" body)
|
||||
(assert-contains "Body loads the compiled UI" "<script src=\"/js/main.js\"" body))
|
||||
(println)
|
||||
|
||||
(println "Test 4: Response is plain text, not HTML")
|
||||
(if (and (not (str/includes? body "<!DOCTYPE"))
|
||||
(not (str/includes? body "<html")))
|
||||
(do (println " ✓ Response is not HTML") (swap! pass inc))
|
||||
(do (println " ✗ Response appears to be HTML")
|
||||
(swap! fail inc)
|
||||
(swap! errors conj "Response was HTML, expected plain text"))))
|
||||
(println "Test 4: GET /js/main.js serves the compiled UI")
|
||||
(let [resp (get* (str base-url "/js/main.js"))]
|
||||
(assert-eq "HTTP status" 200 (:status resp))
|
||||
(assert-contains "Content-Type" "javascript" (get (:headers resp) "content-type" ""))
|
||||
(assert-not-empty "Body is non-empty" (:body resp))
|
||||
(assert-contains "Bundle calls the add API" "/api/add" (:body resp)))
|
||||
(println)
|
||||
|
||||
(println "Test 5: HEAD / returns 200")
|
||||
|
||||
Reference in New Issue
Block a user