cat/test/clj/cat/test/handler.clj
2019-01-11 23:10:58 +01:00

27 lines
706 B
Clojure

(ns cat.test.handler
(:require [clojure.test :refer :all]
[ring.mock.request :refer :all]
[cat.handler :refer :all]
[cat.middleware.formats :as formats]
[muuntaja.core :as m]
[mount.core :as mount]))
(defn parse-json [body]
(m/decode formats/instance "application/json" body))
(use-fixtures
:once
(fn [f]
(mount/start #'cat.config/env
#'cat.handler/app)
(f)))
(deftest test-app
(testing "main route"
(let [response (app (request :get "/"))]
(is (= 200 (:status response)))))
(testing "not-found route"
(let [response (app (request :get "/invalid"))]
(is (= 404 (:status response))))))