add test for anti-forgery-token

integration-tests
Josha von Gizycki 6 years ago
parent 4e2588accc
commit 86ceeca960

@ -4,6 +4,7 @@
valid? valid?
render-widgets render-widgets
form-hash]] form-hash]]
[clojure.string :refer [starts-with?]]
[clojure.spec.alpha :as spec])) [clojure.spec.alpha :as spec]))
(deftest test-form-data (deftest test-form-data
@ -69,6 +70,12 @@
:id "__form-hash" :id "__form-hash"
:value (form-hash def {})}]) :value (form-hash def {})}])
(rest (render-widgets def {} {})))))) (rest (render-widgets def {} {}))))))
(testing "anti-forgery-field is rendered"
(let [def {:fields {}}]
(is (starts-with? (first (render-widgets def {} {}))
(str "<input id=\"__anti-forgery-token\""
" name=\"__anti-forgery-token\""
" type=\"hidden\"")))))
(testing "input is rendered correctly" (testing "input is rendered correctly"
(let [def {:fields {:foo-id {:label "foo-label" (let [def {:fields {:foo-id {:label "foo-label"
:widget :input}}}] :widget :input}}}]

Loading…
Cancel
Save