-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice_test.clj
40 lines (35 loc) · 1.54 KB
/
service_test.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(ns clojure-api.service-test
(:require [clojure.test :refer :all]
[io.pedestal.test :refer :all]
[io.pedestal.http :as bootstrap]
[clojure-api.service :as service]))
(def service
(::bootstrap/service-fn (bootstrap/create-servlet service/service)))
(deftest home-page-test
(is (=
(:body (response-for service :get "/"))
"Hello World!"))
(is (=
(:headers (response-for service :get "/"))
{"Content-Type" "text/html;charset=UTF-8"
"Strict-Transport-Security" "max-age=31536000; includeSubdomains"
"X-Frame-Options" "DENY"
"X-Content-Type-Options" "nosniff"
"X-XSS-Protection" "1; mode=block"
"X-Download-Options" "noopen"
"X-Permitted-Cross-Domain-Policies" "none"
"Content-Security-Policy" "object-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' https: http:;"})))
(deftest about-page-test
(is
(re-find #"Clojure \d+\.\d+(\.\d+)?"
(:body (response-for service :get "/about"))))
(is (=
(:headers (response-for service :get "/about"))
{"Content-Type" "text/html;charset=UTF-8"
"Strict-Transport-Security" "max-age=31536000; includeSubdomains"
"X-Frame-Options" "DENY"
"X-Content-Type-Options" "nosniff"
"X-XSS-Protection" "1; mode=block"
"X-Download-Options" "noopen"
"X-Permitted-Cross-Domain-Policies" "none"
"Content-Security-Policy" "object-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' https: http:;"})))